emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: format-mode-line


From: Nick Roberts
Subject: Re: format-mode-line
Date: Thu, 6 Jan 2005 13:21:38 +1300

 >     I suggest changing format-mode-line so that FORMAT is not optional and 
 > not
 >     give a special meaning to nil and t. I think format-mode-line is 
 > currently
 >     always used with a value for FORMAT. If this is a good idea, I offer to 
 > do
 >     it and post my patch here.
 > 
 > The argument above seems convincing, so please do.

Here's the patch.

Nick

*** /home/nick/emacs/src/xdisp.c.~1.954.~       2005-01-06 12:32:47.000000000 
+1300
--- /home/nick/emacs/src/xdisp.c        2005-01-06 12:44:01.000000000 +1300
***************
*** 15969,15982 ****
  
  
  DEFUN ("format-mode-line", Fformat_mode_line, Sformat_mode_line,
!        0, 4, 0,
         doc: /* Return the mode-line of selected window as a string.
! First optional arg FORMAT specifies the mode line format (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.
! Fourth optional arg BUFFER specifies which buffer to use.  */)
    (format, window, no_props, buffer)
       Lisp_Object format, window, no_props, buffer;
  {
--- 15969,15981 ----
  
  
  DEFUN ("format-mode-line", Fformat_mode_line, Sformat_mode_line,
!        1, 4, 0,
         doc: /* Return the mode-line of selected window as a string.
! First arg FORMAT specifies the mode line format (see `mode-line-format' for
! details) to use.  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.  Fourth optional arg BUFFER specifies
! which buffer to use.  */)
    (format, window, no_props, buffer)
       Lisp_Object format, window, no_props, buffer;
  {
***************
*** 16002,16017 ****
        set_buffer_internal_1 (XBUFFER (buffer));
      }
  
-   if (NILP (format) || EQ (format, Qt))
-     {
-       face_id = (NILP (format)
-                ? CURRENT_MODE_LINE_FACE_ID (w)
-                : HEADER_LINE_FACE_ID);
-       format = (NILP (format)
-               ? current_buffer->mode_line_format
-               : current_buffer->header_line_format);
-     }
- 
    init_iterator (&it, w, -1, -1, NULL, face_id);
  
    if (NILP (no_props))
--- 16001,16006 ----

*** /home/nick/emacs/lispref/modes.texi.~1.82.~ 2005-01-01 19:31:23.000000000 
+1300
--- /home/nick/emacs/lispref/modes.texi 2005-01-06 12:53:46.000000000 +1300
***************
*** 1736,1753 ****
  the text that would appear in a mode line or header line
  based on certain mode-line specification.
  
! @defun format-mode-line &optional format window no-props buffer
  This function formats a line of text according to @var{format} as if
  it were generating the mode line for @var{window}, but instead of
  displaying the text in the mode line or the header line, it returns
  the text as a string.
  
! If @var{format} is @code{nil}, that means to use
! @code{mode-line-format} and return the text that would appear in the
! mode line.  If @var{format} is @code{t}, that means to use
! @code{header-line-format} so as to return the text that would appear
! in the header line (@code{""} if the window has no header line).
! The argument @var{window} defaults to the selected window.
  
  The value string normally has text properties that correspond to the
  faces, keymaps, etc., that the mode line would have.  If
--- 1736,1751 ----
  the text that would appear in a mode line or header line
  based on certain mode-line specification.
  
! @defun format-mode-line format &optional window no-props buffer
  This function formats a line of text according to @var{format} as if
  it were generating the mode line for @var{window}, but instead of
  displaying the text in the mode line or the header line, it returns
  the text as a string.
  
! For example, if @var{format} is @code{header-line-format} it returns the
! text that would appear in the header line (@code{""} if the window has
! no header line).  The argument @var{window} defaults to the selected
! window.
  
  The value string normally has text properties that correspond to the
  faces, keymaps, etc., that the mode line would have.  If




reply via email to

[Prev in Thread] Current Thread [Next in Thread]