mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2026-09-10 07:46:51 -04:00
Resurrect effect of 2nd arg t in 'format-mode-line'
* src/xdisp.c (Fformat_mode_line): Resurrect support for FACE = t. Doc fix. (Bug#81271) * doc/lispref/modes.texi (Emulating Mode Line): Fix documentation of 'format-mode-line' when 2nd argument is t. * test/src/xdisp-tests.el (xdisp-test-format-mode-line): New test.
This commit is contained in:
parent
3eb124692d
commit
e78a0fc9f4
|
|
@ -2869,7 +2869,7 @@ The value string normally has text properties that correspond to the
|
|||
faces, keymaps, etc., that the mode line would have. Any character for
|
||||
which no @code{face} property is specified by @var{format} gets a
|
||||
default value determined by @var{face}. If @var{face} is @code{t}, that
|
||||
stands for either @code{mode-line} if @var{window} is selected,
|
||||
stands for either @code{mode-line-active} if @var{window} is selected,
|
||||
otherwise @code{mode-line-inactive}. If @var{face} is @code{nil} or
|
||||
omitted, that stands for the default face. If @var{face} is an integer,
|
||||
the value returned by this function will have no text properties.
|
||||
|
|
|
|||
|
|
@ -28985,7 +28985,7 @@ By default, the format is evaluated for the currently selected window.
|
|||
Optional second arg FACE specifies the face property to put on all
|
||||
characters for which no face is specified. The value nil means the
|
||||
default face. The value t means whatever face the window's mode line
|
||||
currently uses (either `mode-line' or `mode-line-inactive',
|
||||
currently uses (either `mode-line-active' or `mode-line-inactive',
|
||||
depending on whether the window is the selected window or not).
|
||||
An integer value means the value string has no text
|
||||
properties.
|
||||
|
|
@ -29036,6 +29036,11 @@ are the selected window and the WINDOW's buffer). */)
|
|||
: EQ (face, Qtool_bar) ? TOOL_BAR_FACE_ID
|
||||
: DEFAULT_FACE_ID;
|
||||
|
||||
if (EQ (face, Qt))
|
||||
face = EQ (window, selected_window)
|
||||
? Qmode_line_active
|
||||
: Qmode_line_inactive;
|
||||
|
||||
old_buffer = current_buffer;
|
||||
|
||||
/* Save things including mode_line_proptrans_alist,
|
||||
|
|
|
|||
|
|
@ -179,4 +179,17 @@ int main () {
|
|||
(buffer-string)))
|
||||
"foo\n")))
|
||||
|
||||
(ert-deftest xdisp-test-format-mode-line ()
|
||||
;; 'format-mode-line' returns an empty string with no properties in
|
||||
;; noninteractive sessions.
|
||||
(skip-when noninteractive)
|
||||
(with-temp-buffer
|
||||
(insert (format-mode-line " " t))
|
||||
(should (equal (buffer-string) #(" " 0 1 (face mode-line-active)))))
|
||||
(with-temp-buffer
|
||||
(insert (format-mode-line
|
||||
(propertize "x" 'face 'bold-italic)
|
||||
1200000000000000000000000000))
|
||||
(should (null (get-text-property 1 'face)))))
|
||||
|
||||
;;; xdisp-tests.el ends here
|
||||
|
|
|
|||
Loading…
Reference in a new issue