diff options
| author | Richard M. Stallman | 2005-01-12 05:06:46 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2005-01-12 05:06:46 +0000 |
| commit | 43facb76534c54d334b5e396ec624aff3a9c01bc (patch) | |
| tree | a208140bb539a53db3a89a619fce78df08036717 /src | |
| parent | 5ba8f83ded4394bf48a034330181edb50638526a (diff) | |
| download | emacs-43facb76534c54d334b5e396ec624aff3a9c01bc.tar.gz emacs-43facb76534c54d334b5e396ec624aff3a9c01bc.zip | |
(Fformat_mode_line): New arg FACE specifies a default
face property for characters that don't specify one.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xdisp.c | 49 |
1 files changed, 37 insertions, 12 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index 600e01a13e1..7c3eb3cb378 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -15978,27 +15978,50 @@ store_mode_line_string (string, lisp_string, copy_string, field_width, precision | |||
| 15978 | 15978 | ||
| 15979 | 15979 | ||
| 15980 | DEFUN ("format-mode-line", Fformat_mode_line, Sformat_mode_line, | 15980 | DEFUN ("format-mode-line", Fformat_mode_line, Sformat_mode_line, |
| 15981 | 1, 4, 0, | 15981 | 1, 5, 0, |
| 15982 | doc: /* Return the mode-line of selected window as a string. | 15982 | doc: /* Return the mode-line of selected window as a string. |
| 15983 | First arg FORMAT specifies the mode line format (see `mode-line-format' for | 15983 | First arg FORMAT specifies the mode line format (see `mode-line-format' for |
| 15984 | details) to use. Second optional arg WINDOW specifies a different window to | 15984 | details) to use. Second (optional) arg WINDOW specifies the window to |
| 15985 | use as the context for the formatting. If third optional arg NO-PROPS is | 15985 | use as the context for the formatting (default is the selected window). |
| 15986 | non-nil, string is not propertized. Fourth optional arg BUFFER specifies | 15986 | |
| 15987 | which buffer to use. */) | 15987 | If third (optional) arg NO-PROPS is non-nil, the value string has |
| 15988 | (format, window, no_props, buffer) | 15988 | no text properties. The fourth (optional) arg BUFFER specifies |
| 15989 | Lisp_Object format, window, no_props, buffer; | 15989 | which buffer to use (default, the current buffer). |
| 15990 | |||
| 15991 | Fifth (optional) arg FACE specifies the face property to put | ||
| 15992 | on all characters for which no face is specified. | ||
| 15993 | t means whatever face the window's mode line currently uses | ||
| 15994 | \(either `mode-line' or `mode-line-inactive', depending). | ||
| 15995 | nil means the default is no face property. */) | ||
| 15996 | (format, window, no_props, buffer, face) | ||
| 15997 | Lisp_Object format, window, no_props, buffer, face; | ||
| 15990 | { | 15998 | { |
| 15991 | struct it it; | 15999 | struct it it; |
| 15992 | int len; | 16000 | int len; |
| 15993 | struct window *w; | 16001 | struct window *w; |
| 15994 | struct buffer *old_buffer = NULL; | 16002 | struct buffer *old_buffer = NULL; |
| 15995 | enum face_id face_id = DEFAULT_FACE_ID; | 16003 | enum face_id face_id; |
| 15996 | 16004 | ||
| 15997 | if (NILP (window)) | 16005 | if (NILP (window)) |
| 15998 | window = selected_window; | 16006 | window = selected_window; |
| 15999 | CHECK_WINDOW (window); | 16007 | CHECK_WINDOW (window); |
| 16000 | w = XWINDOW (window); | 16008 | w = XWINDOW (window); |
| 16001 | 16009 | ||
| 16010 | if (EQ (face, Qt)) | ||
| 16011 | face = (EQ (window, selected_window) ? Qmode_line : Qmode_line_inactive); | ||
| 16012 | |||
| 16013 | if (!NILP (face)) | ||
| 16014 | { | ||
| 16015 | Lisp_Object tem = Fget (face, Qface); | ||
| 16016 | if (INTEGERP (tem)) | ||
| 16017 | face_id = XINT (tem); | ||
| 16018 | else | ||
| 16019 | { | ||
| 16020 | face = Qnil; | ||
| 16021 | face_id = DEFAULT_FACE_ID; | ||
| 16022 | } | ||
| 16023 | } | ||
| 16024 | |||
| 16002 | if (NILP (buffer)) | 16025 | if (NILP (buffer)) |
| 16003 | buffer = w->buffer; | 16026 | buffer = w->buffer; |
| 16004 | 16027 | ||
| @@ -16010,14 +16033,16 @@ which buffer to use. */) | |||
| 16010 | set_buffer_internal_1 (XBUFFER (buffer)); | 16033 | set_buffer_internal_1 (XBUFFER (buffer)); |
| 16011 | } | 16034 | } |
| 16012 | 16035 | ||
| 16036 | if (NILP (format) || EQ (format, Qt)) | ||
| 16037 | face_id = (NILP (format) | ||
| 16038 | ? CURRENT_MODE_LINE_FACE_ID (w) | ||
| 16039 | : HEADER_LINE_FACE_ID); | ||
| 16040 | |||
| 16013 | init_iterator (&it, w, -1, -1, NULL, face_id); | 16041 | init_iterator (&it, w, -1, -1, NULL, face_id); |
| 16014 | 16042 | ||
| 16015 | if (NILP (no_props)) | 16043 | if (NILP (no_props)) |
| 16016 | { | 16044 | { |
| 16017 | mode_line_string_face | 16045 | mode_line_string_face = face; |
| 16018 | = (face_id == MODE_LINE_FACE_ID ? Qmode_line | ||
| 16019 | : face_id == MODE_LINE_INACTIVE_FACE_ID ? Qmode_line_inactive | ||
| 16020 | : face_id == HEADER_LINE_FACE_ID ? Qheader_line : Qnil); | ||
| 16021 | 16046 | ||
| 16022 | mode_line_string_face_prop | 16047 | mode_line_string_face_prop |
| 16023 | = (NILP (mode_line_string_face) ? Qnil | 16048 | = (NILP (mode_line_string_face) ? Qnil |