bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#7307: 24.0.50; Mode line had more than just dashes removed


From: Stephen Berman
Subject: bug#7307: 24.0.50; Mode line had more than just dashes removed
Date: Sat, 30 Oct 2010 17:23:22 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

On Sat, 30 Oct 2010 15:49:22 +0200 Eli Zaretskii <address@hidden> wrote:

>> From: Stephen Berman <address@hidden>
>
>> 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 "%-".
>
> IMO, this is cleaner.  Thanks.

There was a copy 'n' paste error in the patch, so here it is again, with
ChangeLog entries added.

Steve Berman


=== modified file 'doc/lispref/ChangeLog'
2010-10-30  Stephen Berman  <address@hidden>

        * modes.texi (`%'-Constructs in the Mode Line): Document '%_'
        construct, which insert spaces at end of mode line (bug#7307).

=== modified file 'lisp/ChangeLog'
2010-10-30  Stephen Berman  <address@hidden>

        * bindings.el: Use '%_' construct to insert spaces at end of mode
        line in graphical display (bug#7307).

=== modified file 'src/ChangeLog'
2010-10-30  Stephen Berman  <address@hidden>

        * buffer.c (syms_of_buffer) <mode-line-format>: Document '%_'
        construct, which insert spaces at end of mode line (bug#7307).

        * xdisp.c (lots_of_spaces): New string variable.
        (decode_mode_spec): Add '%_' construct to insert spaces
        at end of mode line (bug#7307).

=== 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.
 
address@hidden %_
+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 15:13:13 +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_spaces;
+      }
+
     case 'b':
       obj = b->name;
       break;






reply via email to

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