/[emacs]/emacs/src/xdisp.c
ViewVC logotype

Diff of /emacs/src/xdisp.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.961 by rms, Wed Jan 12 05:06:46 2005 UTC revision 1.962 by kfstorm, Thu Jan 13 09:36:01 2005 UTC
# Line 15978  store_mode_line_string (string, lisp_str Line 15978  store_mode_line_string (string, lisp_str
15978    
15979    
15980  DEFUN ("format-mode-line", Fformat_mode_line, Sformat_mode_line,  DEFUN ("format-mode-line", Fformat_mode_line, Sformat_mode_line,
15981         1, 5, 0,         1, 4, 0,
15982         doc: /* Return the mode-line of selected window as a string.         doc: /* Format a string out of a mode line format specification.
15983  First arg FORMAT specifies the mode line format (see `mode-line-format' for  First arg FORMAT specifies the mode line format (see `mode-line-format'
15984  details) to use.  Second (optional) arg WINDOW specifies the window to  for details) to use.
 use as the context for the formatting (default is the selected window).  
   
 If third (optional) arg NO-PROPS is non-nil, the value string has  
 no text properties.  The fourth (optional) arg BUFFER specifies  
 which buffer to use (default, the current buffer).  
15985    
15986  Fifth (optional) arg FACE specifies the face property to put  Optional second arg FACE specifies the face property to put
15987  on all characters for which no face is specified.  on all characters for which no face is specified.
15988  t means whatever face the window's mode line currently uses  t means whatever face the window's mode line currently uses
15989  \(either `mode-line' or `mode-line-inactive', depending).  \(either `mode-line' or `mode-line-inactive', depending).
15990  nil means the default is no face property.  */)  nil means the default is no face property.
15991    (format, window, no_props, buffer, face)  If FACE is an integer, the value string has no text properties.
15992       Lisp_Object format, window, no_props, buffer, face;  
15993    Optional third and fourth args WINDOW and BUFFER specify the window
15994    and buffer to use as the context for the formatting (defaults
15995    are the selected window and the window's buffer).  */)
15996      (format, face, window, buffer)
15997         Lisp_Object format, face, window, buffer;
15998  {  {
15999    struct it it;    struct it it;
16000    int len;    int len;
16001    struct window *w;    struct window *w;
16002    struct buffer *old_buffer = NULL;    struct buffer *old_buffer = NULL;
16003    enum face_id face_id;    int face_id = -1;
16004      int no_props = INTEGERP (face);
16005    
16006    if (NILP (window))    if (NILP (window))
16007      window = selected_window;      window = selected_window;
16008    CHECK_WINDOW (window);    CHECK_WINDOW (window);
16009    w = XWINDOW (window);    w = XWINDOW (window);
16010    
16011    if (EQ (face, Qt))    if (NILP (buffer))
16012      face = (EQ (window, selected_window) ? Qmode_line : Qmode_line_inactive);      buffer = w->buffer;
16013      CHECK_BUFFER (buffer);
16014    
16015      if (NILP (format))
16016        return build_string ("");
16017    
16018      if (no_props)
16019        face = Qnil;
16020    
16021    if (!NILP (face))    if (!NILP (face))
16022      {      {
16023        Lisp_Object tem = Fget (face, Qface);        if (EQ (face, Qt))
16024        if (INTEGERP (tem))          face = (EQ (window, selected_window) ? Qmode_line : Qmode_line_inactive);
16025          face_id = XINT (tem);        face_id = lookup_named_face (XFRAME (WINDOW_FRAME (w)), face, 0, 0);
       else  
         {  
           face = Qnil;  
           face_id = DEFAULT_FACE_ID;  
         }  
16026      }      }
16027    
16028    if (NILP (buffer))    if (face_id < 0)
16029      buffer = w->buffer;      face_id = DEFAULT_FACE_ID;
   
   CHECK_BUFFER (buffer);  
16030    
16031    if (XBUFFER (buffer) != current_buffer)    if (XBUFFER (buffer) != current_buffer)
16032      {      {
# Line 16033  nil means the default is no face propert Line 16034  nil means the default is no face propert
16034        set_buffer_internal_1 (XBUFFER (buffer));        set_buffer_internal_1 (XBUFFER (buffer));
16035      }      }
16036    
   if (NILP (format) || EQ (format, Qt))  
     face_id = (NILP (format)  
                ? CURRENT_MODE_LINE_FACE_ID (w)  
                : HEADER_LINE_FACE_ID);  
   
16037    init_iterator (&it, w, -1, -1, NULL, face_id);    init_iterator (&it, w, -1, -1, NULL, face_id);
16038    
16039    if (NILP (no_props))    if (!no_props)
16040      {      {
16041        mode_line_string_face = face;        mode_line_string_face = face;
   
16042        mode_line_string_face_prop        mode_line_string_face_prop
16043          = (NILP (mode_line_string_face) ? Qnil          = (NILP (face) ? Qnil : Fcons (Qface, Fcons (face, Qnil)));
            : Fcons (Qface, Fcons (mode_line_string_face, Qnil)));  
16044    
16045        /* We need a dummy last element in mode_line_string_list to        /* We need a dummy last element in mode_line_string_list to
16046           indicate we are building the propertized mode-line string.           indicate we are building the propertized mode-line string.
# Line 16069  nil means the default is no face propert Line 16063  nil means the default is no face propert
16063    if (old_buffer)    if (old_buffer)
16064      set_buffer_internal_1 (old_buffer);      set_buffer_internal_1 (old_buffer);
16065    
16066    if (NILP (no_props))    if (!no_props)
16067      {      {
16068        Lisp_Object str;        Lisp_Object str;
16069        mode_line_string_list = Fnreverse (mode_line_string_list);        mode_line_string_list = Fnreverse (mode_line_string_list);

Legend:
Removed from v.1.961  
changed lines
  Added in v.1.962

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26