elisp - Emacs -- how to consolidate :lighter(s) for minor modes -


is possible consolidate :lighters on mode-line when combination of active minor modes exists? if so, how please?

example:

  • minor mode number 1 has :lighter of " -"

  • minor mode number 2 has :lighter of " +"

if both minor modes active in buffer, consolidate lighters: " ±"

you can dynamically alter lighter value minor mode modifying minor-mode-alist:

(setcar (cdr (assq 'mode minor-mode-alist)) value) 

when either of modes activated or deactivated, check status of other, , set lighter text accordingly. when both active can make 1 empty string, , other 'combined' lighter.

or, better, take advantage of fact mode-line construct valid, , make automatic. using delight.el wrapper above, , assuming both modes defined mylibrary.el might say:

(delight '((mode+ (mode- " ±" " +") "mylibrary")            (mode- (mode+ "" " -") "mylibrary"))) 

that's not perfect -- if want associated pop-up menus combine details of both modes, there's rather more do; recommend don't worry if don't need to. appearance of mode line low-hanging fruit here.


Comments

Popular posts from this blog

php - render data via PDO::FETCH_FUNC vs loop -

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

The canvas has been tainted by cross-origin data in chrome only -