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: Mon, 01 Nov 2010 19:11:49 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

On Sat, 30 Oct 2010 23:54:53 -0400 Stefan Monnier <monnier@iro.umontreal.ca> 
wrote:

>> 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
>
> How 'bout something even simpler: make %- obey a config var which says
> which char to use as filler.  That would default to - under a tty and
> SPC on a GUI.

Hm, this may be conceptually simpler but at least for me not simpler to
implement, if I understand what you're suggesting, namely, that the
filler character should be provided by a defcustom, which is defined in
xdisp.c; is that right?  Before I try to do that, is the following
consistent with what you're suggesting (aside from lack the
configurability)?  If not, could you be more specific?

Steve Berman

=== modified file 'lisp/bindings.el'
--- lisp/bindings.el    2010-10-19 19:20:33 +0000
+++ lisp/bindings.el    2010-11-01 17:32:51 +0000
@@ -336,8 +336,7 @@
         'mode-line-modes
         `(which-func-mode ("" which-func-format ,spaces))
         `(global-mode-string ("" global-mode-string ,spaces))
-        `(:eval (unless (display-graphic-p)
-                  ,(propertize "-%-" 'help-echo help-echo)))))
+        `(:eval ,(propertize "%-" 'help-echo help-echo))))
        (standard-mode-line-modes
        (list
         (propertize "%[" 'help-echo recursive-edit-help-echo)

=== modified file 'src/xdisp.c'
--- src/xdisp.c 2010-10-23 21:19:02 +0000
+++ src/xdisp.c 2010-11-01 17:56:15 +0000
@@ -19267,8 +19267,15 @@
    Note we operate on the current buffer for most purposes,
    the exception being w->base_line_pos.  */
 
+static char lots_of_spaces[] =  "                                              
                                                                                
              ";
+
 static char lots_of_dashes[] = 
"--------------------------------------------------------------------------------------------------------------------------------------------";
 
+/* FIXME: This is wrong rather than test window-system, we should call
+   a new set-selection, which will then dispatch to x-set-selection, or
+   tty-set-selection, or w32-set-selection, ...  */
+EXFUN (Fwindow_system, 1);
+
 static const char *
 decode_mode_spec (struct window *w, register int c, int field_width,
                  int precision, Lisp_Object *string)
@@ -19277,10 +19284,13 @@
   struct frame *f = XFRAME (WINDOW_FRAME (w));
   char *decode_mode_spec_buf = f->decode_mode_spec_buffer;
   struct buffer *b = current_buffer;
+  static char *mode_line_filler;
 
   obj = Qnil;
   *string = Qnil;
-
+  mode_line_filler = !NILP (Fwindow_system (Qnil)) ? lots_of_spaces 
+    : lots_of_dashes;
+  
   switch (c)
     {
     case '*':
@@ -19339,20 +19349,27 @@
       {
        register int i;
 
-       /* Let lots_of_dashes be a string of infinite length.  */
+       /* Let mode_line_filler 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_dashes))
+           || field_width > sizeof (mode_line_filler))
          {
            for (i = 0; i < FRAME_MESSAGE_BUF_SIZE (f) - 1; ++i)
-             decode_mode_spec_buf[i] = '-';
+             if (!NILP (Fwindow_system (Qnil)))
+               {
+                 decode_mode_spec_buf[i] = ' ';
+               }
+             else
+               {
+                 decode_mode_spec_buf[i] = '-';
+               }
            decode_mode_spec_buf[i] = '\0';
            return decode_mode_spec_buf;
          }
        else
-         return lots_of_dashes;
+         return mode_line_filler;
       }
 
     case 'b':






reply via email to

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