Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does Emacs select which minor modes to list in the mode line?

I plan to customize mode line in Emacs in near future, and i don't understand the algorithm behind listing minor modes in the mode line.

In section «1.3 The Mode Line» of Emacs manual it says: «MINOR is a list of some of the enabled "minor modes"»

While in section «23.2 Minor Modes» it says: «Most buffer-local minor modes say in the mode line when they are enabled»

However i have ErgoEmacs minor mode listed, which is global. Can somebody explain the mechanism behind this and preferably point at various elisp sources responsible for that?

like image 223
Mirzhan Irkegulov Avatar asked Apr 08 '12 07:04

Mirzhan Irkegulov


2 Answers

You can change what is displayed for a specific minor mode by doing something like the following

(setcar (cdr (assq 'yas/minor-mode minor-mode-alist)) " ¥")

which will display " ¥" for yasnippet mode. I do this a lot, especially for modes that I often use since it shortens my mode-line considerably.

like image 78
Ivan Andrus Avatar answered Sep 21 '22 02:09

Ivan Andrus


This is specified for each individual mode, by the mode's own definition.

If you read on to section 23.3.3 - Defining Minor Modes:

The string LIGHTER says what to display in the mode line when the mode is enabled; if it is `nil', the mode is not displayed in the mode line.

See:

M-: (info "(elisp) Defining Minor Modes") RET

C-hf define-minor-mode RET

See also http://www.emacswiki.org/emacs/DelightedModes which facilitates easy customisation of the mode line display for both major and minor modes.

like image 23
phils Avatar answered Sep 22 '22 02:09

phils