all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stephen Berman <stephen.berman@gmx.net>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 7307@debbugs.gnu.org
Subject: bug#7307: 24.0.50; Mode line had more than just dashes removed
Date: Mon, 01 Nov 2010 19:11:49 +0100	[thread overview]
Message-ID: <87iq0g6hi2.fsf@escher.home> (raw)
In-Reply-To: <jwvk4kzf25t.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Sat, 30 Oct 2010 23:54:53 -0400")

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	other threads:[~2010-11-01 18:11 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
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 [this message]
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

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

  git send-email \
    --in-reply-to=87iq0g6hi2.fsf@escher.home \
    --to=stephen.berman@gmx.net \
    --cc=7307@debbugs.gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.