[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

23.3.2 Variables Used in the Mode Line

This section describes variables incorporated by the standard value of mode-line-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 mode line if mode-line-format were changed to use them.

Variable: mode-line-mule-info
This variable holds the value of the mode-line construct that displays information about the language environment, buffer coding system, and current input method. See section 33. Non-ASCII Characters.

Variable: mode-line-modified
This variable holds the value of the mode-line construct that displays whether the current buffer is modified.

The default value of mode-line-modified is ("%1*%1+"). This means that the mode line 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 mode line.

Variable: mode-line-frame-identification
This variable identifies the current frame. The default value is " " if you are using a window system which can show multiple frames, or "-%F " on an ordinary terminal which shows only one frame at a time.

Variable: mode-line-buffer-identification
This variable identifies the buffer being displayed in the window. Its default value is ("%12b"), which displays the buffer name, padded with spaces to at least 12 columns.

Variable: global-mode-string
This variable holds a mode line 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 that is obsolete, since the variable is included in the mode line from mode-line-format.

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 mode line.

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

 
(minor-mode-variable mode-line-string)

More generally, mode-line-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 itself is not buffer-local. Each variable mentioned in the alist should be buffer-local if its minor mode can be enabled separately in each buffer.

Variable: mode-line-process
This buffer-local variable contains the mode line 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.

Some variables are used by minor-mode-alist to display a string for various minor modes when enabled. This is a typical example:

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

The variable default-mode-line-format is where mode-line-format usually gets its value:

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

The default value of default-mode-line-format is this list:

 
("-"
 mode-line-mule-info
 mode-line-modified
 mode-line-frame-identification
 mode-line-buffer-identification
 "   "
 global-mode-string
 "   %[("
 ;; mode-line-mode-name is a function
 ;; that copies the mode name and adds text
 ;; properties to make it mouse-sensitive.
 (:eval (mode-line-mode-name))
 mode-line-process
 minor-mode-alist 
 "%n" 
 ")%]--"
 (which-func-mode ("" which-func-format "--"))
 (line-number-mode "L%l--")
 (column-number-mode "C%c--")
 (-3 . "%p")
 "-%-")


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated on May 2, 2002 using texi2html