I am reluctantly using a coloured active mode line to
distinguish it from inactive mode lines, but it occurred to me
that it might be possible to reserve its colouring for times
when there are more than one window in the frame (when there
could be some doubt as to which is the active window). Any tips
on how to do this would be appreciated.
Here is a slight varation of a previous answer of mine:
CAVEAT: In addition to the
buffer-list-update-hook, it may be helpful to add the function
ml-update-all to additional hooks; e.g., it is possible to change the mode-line(s) and the color of the mini-buffer text when entering/exiting the mini-buffer ....
(defvar ml-selected-window nil "Doc-string.") (defun ml-record-selected-window () (setq ml-selected-window (selected-window))) (defun ml-update-all () (force-mode-line-update t)) (add-hook 'post-command-hook 'ml-record-selected-window) (add-hook 'buffer-list-update-hook 'ml-update-all) (setq-default mode-line-format '(:eval (cond ((and (eq ml-selected-window (selected-window)) (one-window-p)) (propertize "ACTIVE -- ONE (1) WINDOW" 'face '(:foreground "red"))) ((and (eq ml-selected-window (selected-window)) (not (one-window-p))) (propertize "ACTIVE -- MANY WINDOWS" 'face '(:foreground "blue"))) (t "INACTIVE"))))
Here is a link to the opening thread on the Emacs Devel mailing list from 10/26/2019 entitled "Let mode-line packages distinguish the selected-window", wherein some of the thread participants provide Lisp variations (examples) to programmatically distinguish the selected window when the mode-line is updated:
Answered by lawlist on December 14, 2020
1 Asked on January 1, 2021 by malvineous
1 Asked on January 1, 2021 by rl1
1 Asked on December 26, 2020
1 Asked on December 17, 2020 by a_subscriber
0 Asked on December 16, 2020 by roman-smirnov
1 Asked on December 14, 2020 by toothrot
1 Asked on December 12, 2020 by tom-dalziel
0 Asked on December 12, 2020 by rajkumar-natarajan
0 Asked on December 11, 2020 by eugene
1 Asked on December 11, 2020 by intel_chris
Get help from others!