From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Nick Roberts Newsgroups: gmane.emacs.devel Subject: Re: format-mode-line Date: Thu, 6 Jan 2005 13:21:38 +1300 Message-ID: <16860.33938.337020.736393@farnswood.snap.net.nz> References: <16858.35618.823283.184368@farnswood.snap.net.nz> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1104971965 20994 80.91.229.6 (6 Jan 2005 00:39:25 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 6 Jan 2005 00:39:25 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jan 06 01:39:12 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1CmLgF-0003mI-00 for ; Thu, 06 Jan 2005 01:39:11 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CmLrW-0002i8-Ob for ged-emacs-devel@m.gmane.org; Wed, 05 Jan 2005 19:50:50 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1CmLrN-0002fv-Fw for emacs-devel@gnu.org; Wed, 05 Jan 2005 19:50:41 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1CmLrL-0002eE-Ar for emacs-devel@gnu.org; Wed, 05 Jan 2005 19:50:39 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CmLrL-0002eB-7J for emacs-devel@gnu.org; Wed, 05 Jan 2005 19:50:39 -0500 Original-Received: from [199.232.41.8] (helo=mx20.gnu.org) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.34) id 1CmLf8-0003w2-5y; Wed, 05 Jan 2005 19:38:02 -0500 Original-Received: from [202.37.101.8] (helo=viper.snap.net.nz) by mx20.gnu.org with esmtp (Exim 4.34) id 1CmLei-0000xn-5i; Wed, 05 Jan 2005 19:37:36 -0500 Original-Received: from farnswood.snap.net.nz (p144-tnt2.snap.net.nz [202.124.108.144]) by viper.snap.net.nz (Postfix) with ESMTP id DBBCA168E78; Thu, 6 Jan 2005 13:37:29 +1300 (NZDT) Original-Received: by farnswood.snap.net.nz (Postfix, from userid 501) id 1CBEE628AD; Thu, 6 Jan 2005 00:21:38 +0000 (GMT) Original-To: rms@gnu.org In-Reply-To: X-Mailer: VM 7.19 under Emacs 21.3.50.25 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:31927 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:31927 > 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