Next: , Previous: , Up: Modeline Format   [Contents][Index]


33.3.2 Variables Used in the Modeline

This section describes variables incorporated by the standard value of modeline-format into the text of the mode line. There is nothing inherently special about these variables; any other variables could have the same effects on the modeline if modeline-format were changed to use them.

Variable: modeline-modified

This variable holds the value of the modeline construct that displays whether the current buffer is modified.

The default value of modeline-modified is ("--%1*%1+-"). This means that the modeline displays ‘--**-’ if the buffer is modified, ‘-----’ if the buffer is not modified, ‘--%%-’ if the buffer is read only, and ‘--%*--’ if the buffer is read only and modified.

Changing this variable does not force an update of the modeline.

Variable: modeline-buffer-identification

This variable identifies the buffer being displayed in the window. Its default value is ("%F: %17b"), which means that it usually displays ‘SXEmacs:’ followed by seventeen characters of the buffer name.

In a terminal frame, it displays the frame name instead of ‘SXEmacs’; this has the effect of showing the frame number.) You may want to change this in modes such as Rmail that do not behave like a “normal” SXEmacs.

Variable: global-mode-string

This variable holds a modeline spec that appears in the mode line by default, just after the buffer name. The command display-time sets global-mode-string to refer to the variable display-time-string, which holds a string containing the time and load information.

The ‘%M’ construct substitutes the value of global-mode-string, but this is obsolete, since the variable is included directly in the modeline.

Variable: mode-name

This buffer-local variable holds the “pretty” name of the current buffer’s major mode. Each major mode should set this variable so that the mode name will appear in the modeline.

Variable: minor-mode-alist

This variable holds an association list whose elements specify how the modeline should indicate that a minor mode is active. Each element of the minor-mode-alist should be a two-element list:

(minor-mode-variable modeline-string)

More generally, modeline-string can be any mode line spec. It appears in the mode line when the value of minor-mode-variable is non-nil, and not otherwise. These strings should begin with spaces so that they don’t run together. Conventionally, the minor-mode-variable for a specific mode is set to a non-nil value when that minor mode is activated.

The default value of minor-mode-alist is:

minor-mode-alist
⇒ ((vc-mode vc-mode)
    (abbrev-mode " Abbrev")
    (overwrite-mode overwrite-mode)
    (auto-fill-function " Fill")
    (defining-kbd-macro " Def")
    (isearch-mode isearch-mode))

minor-mode-alist is not buffer-local. The variables mentioned in the alist should be buffer-local if the minor mode can be enabled separately in each buffer.

Variable: modeline-process

This buffer-local variable contains the modeline information on process status in modes used for communicating with subprocesses. It is displayed immediately following the major mode name, with no intervening space. For example, its value in the ‘*shell*’ buffer is (": %s"), which allows the shell to display its status along with the major mode as: ‘(Shell: run)’. Normally this variable is nil.

Variable: default-modeline-format

This variable holds the default modeline-format for buffers that do not override it. This is the same as (default-value 'modeline-format).

The default value of default-modeline-format is:

(""
 modeline-modified
 modeline-buffer-identification
 "   "
 global-mode-string
 "   %[("
 mode-name
 modeline-process
 minor-mode-alist
 "%n"
 ")%]----"
 (line-number-mode "L%l--")
 (-3 . "%p")
 "-%-")
Variable: vc-mode

The variable vc-mode, local in each buffer, records whether the buffer’s visited file is maintained with version control, and, if so, which kind. Its value is nil for no version control, or a string that appears in the mode line.


Next: , Previous: , Up: Modeline Format   [Contents][Index]