From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stephen Berman Newsgroups: gmane.emacs.bugs Subject: bug#7307: 24.0.50; Mode line had more than just dashes removed Date: Sat, 30 Oct 2010 15:27:32 +0200 Message-ID: <87wrozbykb.fsf@escher.home> References: <871v78mwg3.fsf@escher.home> <831v786un1.fsf@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1288446211 709 80.91.229.12 (30 Oct 2010 13:43:31 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 30 Oct 2010 13:43:31 +0000 (UTC) Cc: 7307@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Oct 30 15:43:26 2010 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PCBiO-0002Wr-0Y for geb-bug-gnu-emacs@m.gmane.org; Sat, 30 Oct 2010 15:43:24 +0200 Original-Received: from localhost ([127.0.0.1]:46365 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PCBiN-0007oh-Hf for geb-bug-gnu-emacs@m.gmane.org; Sat, 30 Oct 2010 09:43:23 -0400 Original-Received: from [140.186.70.92] (port=47084 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PCBiH-0007oO-Bs for bug-gnu-emacs@gnu.org; Sat, 30 Oct 2010 09:43:18 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PCBiC-0002N0-8D for bug-gnu-emacs@gnu.org; Sat, 30 Oct 2010 09:43:17 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:47175) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PCBiC-0002Ma-2L for bug-gnu-emacs@gnu.org; Sat, 30 Oct 2010 09:43:12 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1PCBPe-0005S6-DS; Sat, 30 Oct 2010 09:24:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stephen Berman Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 30 Oct 2010 13:24:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 7307 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 7307-submit@debbugs.gnu.org id=B7307.128844500420948 (code B ref 7307); Sat, 30 Oct 2010 13:24:02 +0000 Original-Received: (at 7307) by debbugs.gnu.org; 30 Oct 2010 13:23:24 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PCBP1-0005Rp-Kq for submit@debbugs.gnu.org; Sat, 30 Oct 2010 09:23:23 -0400 Original-Received: from mailout-de.gmx.net ([213.165.64.22] helo=mail.gmx.net) by debbugs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1PCBOz-0005Rk-9X for 7307@debbugs.gnu.org; Sat, 30 Oct 2010 09:23:22 -0400 Original-Received: (qmail invoked by alias); 30 Oct 2010 13:27:34 -0000 Original-Received: from i59F5661A.versanet.de (EHLO escher.home) [89.245.102.26] by mail.gmx.net (mp048) with SMTP; 30 Oct 2010 15:27:34 +0200 X-Authenticated: #20778731 X-Provags-ID: V01U2FsdGVkX18C8H1fXUICJNx+GLtKdW6+E3A1itCzT3bgqJkZu6 clvEe1O+JD2E7D Original-Received: by escher.home (Postfix, from userid 1000) id 0FDCB103B9; Sat, 30 Oct 2010 15:27:32 +0200 (CEST) In-Reply-To: <831v786un1.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 30 Oct 2010 08:51:14 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-Y-GMX-Trusted: 0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Sat, 30 Oct 2010 09:24:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:41271 Archived-At: On Sat, 30 Oct 2010 08:51:14 +0200 Eli Zaretskii wrote: >> From: Stephen Berman >> Date: Sat, 30 Oct 2010 01:05:32 +0200 >> Cc: >> >> The only problem is specifying the length of the >> string: (window-width) as the maximum possible length fails here, >> because the mode line is constructed before the window-system frame, and >> has a value of just 10. So I just picked 200 as a plausible maximum. >> Maybe there's a better way, but this seems to work ok. > > Would it help to use window-width as the maximum? ?? See above. Or did you mean something else? (Though I see that what I wrote is a bit garbled: it should say "(window-width) has a value of just 10".) Anyway, maybe it's less kludgy to introduce a mode line %-construct for spaces. Here's a patch for that, which just adapts the code for "%-". It seems to works (but so does my other lisp-only patch). (Interestingly, lots_of_dashes, and hence lots_of_spaces, has a length of 140, but that's enough at least for my screen.) === modified file 'doc/lispref/modes.texi' --- doc/lispref/modes.texi 2010-08-22 19:30:26 +0000 +++ doc/lispref/modes.texi 2010-10-30 13:01:23 +0000 @@ -2029,6 +2029,9 @@ @item %- Dashes sufficient to fill the remainder of the mode line. +@item %_ +Spaces sufficient to fill the remainder of the mode line. + @item %% The character @samp{%}---this is how to include a literal @samp{%} in a string in which @code{%}-constructs are allowed. === modified file 'lisp/bindings.el' --- lisp/bindings.el 2010-10-19 19:20:33 +0000 +++ lisp/bindings.el 2010-10-30 13:01:56 +0000 @@ -336,7 +336,8 @@ 'mode-line-modes `(which-func-mode ("" which-func-format ,spaces)) `(global-mode-string ("" global-mode-string ,spaces)) - `(:eval (unless (display-graphic-p) + `(:eval (if (display-graphic-p) + ,(propertize " %_" 'help-echo help-echo) ,(propertize "-%-" 'help-echo help-echo))))) (standard-mode-line-modes (list === modified file 'src/buffer.c' --- src/buffer.c 2010-10-29 03:29:29 +0000 +++ src/buffer.c 2010-10-30 13:01:37 +0000 @@ -5571,6 +5571,7 @@ remote machine. %[ -- print one [ for each recursive editing level. %] similar. %% -- print %. %- -- print infinitely many dashes. + %_ -- print infinitely many spaces. Decimal digits after the % specify field width to which to pad. */); DEFVAR_LISP_NOPRO ("default-major-mode", &buffer_defaults.major_mode, === modified file 'src/xdisp.c' --- src/xdisp.c 2010-10-23 21:19:02 +0000 +++ src/xdisp.c 2010-10-30 12:37:24 +0000 @@ -19269,6 +19269,8 @@ static char lots_of_dashes[] = "--------------------------------------------------------------------------------------------------------------------------------------------"; +static char lots_of_spaces[] = " "; + static const char * decode_mode_spec (struct window *w, register int c, int field_width, int precision, Lisp_Object *string) @@ -19355,6 +19357,26 @@ return lots_of_dashes; } + case '_': + { + register int i; + + /* Let lots_of_spaces be a string of infinite length. */ + if (mode_line_target == MODE_LINE_NOPROP || + mode_line_target == MODE_LINE_STRING) + return " "; + if (field_width <= 0 + || field_width > sizeof (lots_of_spaces)) + { + for (i = 0; i < FRAME_MESSAGE_BUF_SIZE (f) - 1; ++i) + decode_mode_spec_buf[i] = ' '; + decode_mode_spec_buf[i] = '\0'; + return decode_mode_spec_buf; + } + else + return lots_of_dashes; + } + case 'b': obj = b->name; break;