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: Mon, 01 Nov 2010 19:11:49 +0100 Message-ID: <87iq0g6hi2.fsf@escher.home> References: <871v78mwg3.fsf@escher.home> <831v786un1.fsf@gnu.org> <87wrozbykb.fsf@escher.home> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1288635257 2308 80.91.229.12 (1 Nov 2010 18:14:17 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 1 Nov 2010 18:14:17 +0000 (UTC) Cc: 7307@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Nov 01 19:14:13 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 1PCytY-00051m-MD for geb-bug-gnu-emacs@m.gmane.org; Mon, 01 Nov 2010 19:14:13 +0100 Original-Received: from localhost ([127.0.0.1]:47931 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PCytX-0004yP-SI for geb-bug-gnu-emacs@m.gmane.org; Mon, 01 Nov 2010 14:14:11 -0400 Original-Received: from [140.186.70.92] (port=46886 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PCysq-0004RM-5s for bug-gnu-emacs@gnu.org; Mon, 01 Nov 2010 14:13:29 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PCyso-0000Zm-T6 for bug-gnu-emacs@gnu.org; Mon, 01 Nov 2010 14:13:28 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:59853) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PCyso-0000Zg-R4 for bug-gnu-emacs@gnu.org; Mon, 01 Nov 2010 14:13:26 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1PCynZ-0006fT-RM; Mon, 01 Nov 2010 14:08:01 -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: Mon, 01 Nov 2010 18:08:01 +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.128863485325619 (code B ref 7307); Mon, 01 Nov 2010 18:08:01 +0000 Original-Received: (at 7307) by debbugs.gnu.org; 1 Nov 2010 18:07:33 +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 1PCyn7-0006fA-Ba for submit@debbugs.gnu.org; Mon, 01 Nov 2010 14:07:33 -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 1PCyn5-0006f5-CA for 7307@debbugs.gnu.org; Mon, 01 Nov 2010 14:07:31 -0400 Original-Received: (qmail invoked by alias); 01 Nov 2010 18:11:50 -0000 Original-Received: from i59F56E3C.versanet.de (EHLO escher.home) [89.245.110.60] by mail.gmx.net (mp016) with SMTP; 01 Nov 2010 19:11:50 +0100 X-Authenticated: #20778731 X-Provags-ID: V01U2FsdGVkX1/QOagufRzQZcRlPyMKHF6KnIAKG3UYJDlMZGdZoa RsgAOy2uG5xWMy Original-Received: by escher.home (Postfix, from userid 1000) id AFAA2103B6; Mon, 1 Nov 2010 19:11:49 +0100 (CET) In-Reply-To: (Stefan Monnier's message of "Sat, 30 Oct 2010 23:54:53 -0400") 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: Mon, 01 Nov 2010 14:08:01 -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:41347 Archived-At: On Sat, 30 Oct 2010 23:54:53 -0400 Stefan Monnier 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':