diff options
author | Chong Yidong <cyd@stupidchicken.com> | 2011-01-02 15:31:19 -0500 |
---|---|---|
committer | Chong Yidong <cyd@stupidchicken.com> | 2011-01-02 15:31:19 -0500 |
commit | 7c420169baa7c50428589cca7f8eda71b462eb15 (patch) | |
tree | b556f9e181818bbaf8b5b425844b4ae26e88f537 /src/xdisp.c | |
parent | bb7f5cbcda931661c8dc3311603ac764fa87a639 (diff) | |
parent | d12f22f52cb7bb18b46f5ea8de5d8e8e04733e3f (diff) | |
download | emacs-7c420169baa7c50428589cca7f8eda71b462eb15.tar.gz |
Merge changes from emacs-23 branch
Diffstat (limited to 'src/xdisp.c')
-rw-r--r-- | src/xdisp.c | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index 7a299055185..4e15e8a5f6d 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -19068,23 +19068,27 @@ DEFUN ("format-mode-line", Fformat_mode_line, Sformat_mode_line, First arg FORMAT specifies the mode line format (see `mode-line-format' for details) to use. -Optional second arg FACE specifies the face property to put -on all characters for which no face is specified. -The value t means whatever face the window's mode line currently uses -\(either `mode-line' or `mode-line-inactive', depending). -A value of nil means the default is no face property. -If FACE is an integer, the value string has no text properties. +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', +depending on whether the window is the selected window or not). +An integer value means the value string has no text +properties. Optional third and fourth args WINDOW and BUFFER specify the window and buffer to use as the context for the formatting (defaults -are the selected window and the window's buffer). */) - (Lisp_Object format, Lisp_Object face, Lisp_Object window, Lisp_Object buffer) +are the selected window and the WINDOW's buffer). */) + (Lisp_Object format, Lisp_Object face, + Lisp_Object window, Lisp_Object buffer) { struct it it; int len; struct window *w; struct buffer *old_buffer = NULL; - int face_id = -1; + int face_id; int no_props = INTEGERP (face); int count = SPECPDL_INDEX (); Lisp_Object str; @@ -19107,15 +19111,14 @@ are the selected window and the window's buffer). */) if (no_props) face = Qnil; - if (!NILP (face)) - { - if (EQ (face, Qt)) - face = (EQ (window, selected_window) ? Qmode_line : Qmode_line_inactive); - face_id = lookup_named_face (XFRAME (WINDOW_FRAME (w)), face, 0); - } - - if (face_id < 0) - face_id = DEFAULT_FACE_ID; + face_id = (NILP (face) || EQ (face, Qdefault)) ? DEFAULT_FACE_ID + : EQ (face, Qt) ? (EQ (window, selected_window) + ? MODE_LINE_FACE_ID : MODE_LINE_INACTIVE_FACE_ID) + : EQ (face, Qmode_line) ? MODE_LINE_FACE_ID + : EQ (face, Qmode_line_inactive) ? MODE_LINE_INACTIVE_FACE_ID + : EQ (face, Qheader_line) ? HEADER_LINE_FACE_ID + : EQ (face, Qtool_bar) ? TOOL_BAR_FACE_ID + : DEFAULT_FACE_ID; if (XBUFFER (buffer) != current_buffer) old_buffer = current_buffer; |