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: Fri, 05 Nov 2010 17:18:12 +0100 Message-ID: <87vd4b68xn.fsf@escher.home> References: <871v78mwg3.fsf@escher.home> <831v786un1.fsf@gnu.org> <87wrozbykb.fsf@escher.home> <87iq0g6hi2.fsf@escher.home> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1288975499 1304 80.91.229.12 (5 Nov 2010 16:44:59 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 5 Nov 2010 16:44:59 +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 Fri Nov 05 17:44:53 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 1PEPPI-0005mW-8G for geb-bug-gnu-emacs@m.gmane.org; Fri, 05 Nov 2010 17:44:52 +0100 Original-Received: from localhost ([127.0.0.1]:53187 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PEPPH-0002qW-Km for geb-bug-gnu-emacs@m.gmane.org; Fri, 05 Nov 2010 12:44:51 -0400 Original-Received: from [140.186.70.92] (port=49033 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PEPOZ-0002Bk-Fq for bug-gnu-emacs@gnu.org; Fri, 05 Nov 2010 12:44:45 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PEPO1-0001JG-E4 for bug-gnu-emacs@gnu.org; Fri, 05 Nov 2010 12:44:07 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:36664) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PEPO1-0001J5-Bj for bug-gnu-emacs@gnu.org; Fri, 05 Nov 2010 12:43:33 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1PEOvS-0006cn-AC; Fri, 05 Nov 2010 12:14:02 -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: Fri, 05 Nov 2010 16:14:02 +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.128897362925456 (code B ref 7307); Fri, 05 Nov 2010 16:14:02 +0000 Original-Received: (at 7307) by debbugs.gnu.org; 5 Nov 2010 16:13:49 +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 1PEOvF-0006cX-5g for submit@debbugs.gnu.org; Fri, 05 Nov 2010 12:13:49 -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 1PEOv9-0006cS-Vt for 7307@debbugs.gnu.org; Fri, 05 Nov 2010 12:13:45 -0400 Original-Received: (qmail invoked by alias); 05 Nov 2010 16:18:13 -0000 Original-Received: from i59F55A27.versanet.de (EHLO escher.home) [89.245.90.39] by mail.gmx.net (mp038) with SMTP; 05 Nov 2010 17:18:13 +0100 X-Authenticated: #20778731 X-Provags-ID: V01U2FsdGVkX1+0iuEsqIq04r9ajVWollDEpad97vmTqpH534ZUod JjHDHXc78zAbQF Original-Received: by escher.home (Postfix, from userid 1000) id 429E31049B; Fri, 5 Nov 2010 17:18:12 +0100 (CET) In-Reply-To: (Stefan Monnier's message of "Tue, 02 Nov 2010 10:32:55 -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: Fri, 05 Nov 2010 12:14:02 -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:41393 Archived-At: On Tue, 02 Nov 2010 10:32:55 -0400 Stefan Monnier wrote: >> 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? > > Yes, that's pretty much what I meant, except for the lack > of configurability. To make it configurable, we'll need to build the > lots_of_ string dynamically in all cases. Maybe that can be done > by removing the test of field_width. How about something like the following patch? This builds the string dynamically by filling decode_mode_spec_buf to the desired length, dispensing with an additional lots_of_ string. AFAICT this gives good results (though I admittedly haven't been able to find a case where lots_of_filler (replacing lots_of_dashes) is used; what is such a case?). I also exposed the string character variable mode_line_filler to Lisp, so it could be customizable, but I haven't been able to figure out how to update the mode line with a new character. Also, I don't know the right way to set the default value: I assume it shouldn't be done in decode_mode_spec() as below but at the top level together with the DEFVAR, but then how can it be associated with the window whose mode line is being constructed? Steve Berman *** /home/steve/bzr/emacs/trunk/src/xdisp.c 2010-10-24 13:56:16.000000000 +0200 --- /home/steve/bzr/emacs/quickfixes/src/xdisp.c 2010-11-05 16:02:21.000000000 +0100 *************** *** 642,647 **** --- 642,652 ---- int line_number_displayed; + /* Filler character used by the "%-" mode line spec. Defaults to ' ' + on a graphical display and to '-' on a tty. */ + + static EMACS_INT mode_line_filler; + /* Maximum buffer size for which to display line numbers. */ Lisp_Object Vline_number_display_limit; *************** *** 19267,19274 **** Note we operate on the current buffer for most purposes, the exception being w->base_line_pos. */ - static char lots_of_dashes[] = "--------------------------------------------------------------------------------------------------------------------------------------------"; - static const char * decode_mode_spec (struct window *w, register int c, int field_width, int precision, Lisp_Object *string) --- 19272,19277 ---- *************** *** 19277,19282 **** --- 19280,19286 ---- struct frame *f = XFRAME (WINDOW_FRAME (w)); char *decode_mode_spec_buf = f->decode_mode_spec_buffer; struct buffer *b = current_buffer; + mode_line_filler = (FRAME_WINDOW_P (f)) ? ' ' : '-'; obj = Qnil; *string = Qnil; *************** *** 19338,19358 **** case '-': { register int i; ! ! /* Let lots_of_dashes 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)) ! { ! 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': --- 19342,19362 ---- case '-': { register int i; ! int fill_len; ! int lots_of_filler = 140 * sizeof (char); ! ! /* Make a string of mode_line_filler characters. */ ! fill_len = ! (mode_line_target == MODE_LINE_NOPROP ! || mode_line_target == MODE_LINE_STRING) ! ? 2 ! : ((field_width <= 0 || field_width > lots_of_filler) ! ? FRAME_MESSAGE_BUF_SIZE (f) - 1 ! : lots_of_filler); ! for (i = 0; i < fill_len; ++i) ! decode_mode_spec_buf[i] = mode_line_filler; ! decode_mode_spec_buf[i] = '\0'; ! return decode_mode_spec_buf; } case 'b': *************** *** 26191,26196 **** --- 26195,26204 ---- doc: /* String (or mode line construct) included (normally) in `mode-line-format'. */); Vglobal_mode_string = Qnil; + DEFVAR_INT ("mode-line-filler", &mode_line_filler, + doc: /* Filler character used by the "%-" mode line spec. + Defaults to ' ' on a graphical display and to '-' on a tty. */); + DEFVAR_LISP ("overlay-arrow-position", &Voverlay_arrow_position, doc: /* Marker for where to display an arrow on top of the buffer text. This must be the beginning of a line in order to work.