# HG changeset patch # User Richard M. Stallman # Date 1094693427 0 # Node ID 1e3f2e826c24ff6187c8a9ef8d2d8e11c52de7b6 # Parent 35ae3e1a2ffe4582880d6083104c5d0d54fd6de3 (Fformat_mode_line): New arg BUFFER says which buffer to use. diff -r 35ae3e1a2ffe -r 1e3f2e826c24 src/xdisp.c --- a/src/xdisp.c Wed Sep 08 22:21:31 2004 +0000 +++ b/src/xdisp.c Thu Sep 09 01:30:27 2004 +0000 @@ -15794,15 +15794,16 @@ DEFUN ("format-mode-line", Fformat_mode_line, Sformat_mode_line, - 0, 3, 0, + 0, 4, 0, doc: /* Return the mode-line of selected window as a string. First optional arg FORMAT specifies a different format string (see `mode-line-format' for details) to use. If FORMAT is t, return the buffer's header-line. Second optional arg WINDOW specifies a different window to use as the context for the formatting. -If third optional arg NO-PROPS is non-nil, string is not propertized. */) - (format, window, no_props) - Lisp_Object format, window, no_props; +If third optional arg NO-PROPS is non-nil, string is not propertized. +Fourth optional arg BUFFER specifies which buffer to use. */) + (format, window, no_props, buffer) + Lisp_Object format, window, no_props, buffer; { struct it it; int len; @@ -15814,12 +15815,16 @@ window = selected_window; CHECK_WINDOW (window); w = XWINDOW (window); - CHECK_BUFFER (w->buffer); - - if (XBUFFER (w->buffer) != current_buffer) + + if (NILP (buffer)) + buffer = w->buffer; + + CHECK_BUFFER (buffer); + + if (XBUFFER (buffer) != current_buffer) { old_buffer = current_buffer; - set_buffer_internal_1 (XBUFFER (w->buffer)); + set_buffer_internal_1 (XBUFFER (buffer)); } if (NILP (format) || EQ (format, Qt))