unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stephen Berman <stephen.berman@gmx.net>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 7307@debbugs.gnu.org
Subject: bug#7307: 24.0.50; Mode line had more than just dashes removed
Date: Sat, 30 Oct 2010 15:27:32 +0200	[thread overview]
Message-ID: <87wrozbykb.fsf@escher.home> (raw)
In-Reply-To: <831v786un1.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 30 Oct 2010 08:51:14 +0200")

On Sat, 30 Oct 2010 08:51:14 +0200 Eli Zaretskii <eliz@gnu.org> wrote:

>> From: Stephen Berman <stephen.berman@gmx.net>
>> 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;






  reply	other threads:[~2010-10-30 13:27 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-29 23:05 bug#7307: 24.0.50; Mode line had more than just dashes removed Stephen Berman
2010-10-30  6:51 ` Eli Zaretskii
2010-10-30 13:27   ` Stephen Berman [this message]
2010-10-30 13:49     ` Eli Zaretskii
2010-10-30 15:23       ` Stephen Berman
2010-10-31  3:54     ` Stefan Monnier
2010-11-01 18:11       ` Stephen Berman
2010-11-01 19:32         ` Eli Zaretskii
2010-11-01 23:35           ` Stephen Berman
2010-11-02  5:35             ` Eli Zaretskii
2010-11-02  6:31               ` Eli Zaretskii
2010-11-02 14:32         ` Stefan Monnier
2010-11-05 16:18           ` Stephen Berman
2010-11-05 18:45             ` Andreas Schwab
2010-11-05 23:08               ` Stephen Berman
2010-11-08 18:28             ` Stefan Monnier
2010-11-21  0:37               ` Stephen Berman
2010-10-31  0:49 ` James Cloos
2010-11-01 18:11   ` Stephen Berman
2012-06-03  9:05 ` Chong Yidong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87wrozbykb.fsf@escher.home \
    --to=stephen.berman@gmx.net \
    --cc=7307@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).