[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Elisp manual: @section Mode Line Format is unclear (cont.)
From: |
Stephen J. Turnbull |
Subject: |
Re: Elisp manual: @section Mode Line Format is unclear (cont.) |
Date: |
Fri, 30 Dec 2005 16:33:27 +0900 |
User-agent: |
Gnus/5.1007 (Gnus v5.10.7) XEmacs/21.5-b24 (dandelion, linux) |
Sorry about the premature send. I just got in from playing with my
daughter and my frozen fingers weren't flexible enough to get to C-x C-x....
Prefatory material omitted, here's the beef.
What Alan would like to see, I suppose, is something like:
- Variable: mode-line-format
The value of this variable is a mode-line construct which
describes the mode-line to redisplay.
The simplest form of mode-line construct is a string containing
zero or more %-constructs. A %-construct is a reference to a
variable whose value is to be interpolated into the modeline at
that point. The %-construct is introduced by the character `%',
followed by optional formatting specifications, and terminated by
a single character which indicates the variable whose value is to
be interpolated. *Note:: %-constructs. Example:
`(setq mode-line-format "%B")'
puts the buffer name, and nothing else, in the mode-line of the
current buffer.
A symbol is also a mode-line construct. Its value is interpolated
in the mode-line display, but %-constructs are *not* interpreted.
Example:
`(setq buffer-format "%B" mode-line-format 'buffer-format)'
does not have the same effect as the above. Instead, it produces
a (rather useless) mode-line containing only the string "%B".
The mode-line can include images by [however you do that in Emacs].
Finally, a mode-line construct may be a list of mode-line
constructs. If the car is a symbol, the list is treated as a
conditional. If the symbol's value is non-nil, the cadr is
evaluated (recursively, as necessary), and interpolated.
Otherwise the caddr is evaluated and interpolated.
If the car is an integer, its magnitude is a target width. When
positive, the rest of the elements of the list are evaluated,
concatenated, and if necessary right-padded with spaces to
achieve the target width. When negative, the result is truncated
to the target width.
Otherwise, these are evaluated (recursively, as necessary) until
all resolve to strings, which are concatenated left-to-right to
produce the mode-line display. Example:
`(setq buffer-format "%B" mode-line-format '("%B" buffer-format))'
displays a mode-line containing the buffer name, followed by the
string "%B" with no space intervening.
(Note: the above is not likely to be an accurate description of either
XEmacs or Emacs, as there are other, more arcane possibilities.)
--
School of Systems and Information Engineering http://turnbull.sk.tsukuba.ac.jp
University of Tsukuba Tennodai 1-1-1 Tsukuba 305-8573 JAPAN
Ask not how you can "do" free software business;
ask what your business can "do for" free software.