From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: line-number-mode at EOB (was: Native display of line numbers, improved) Date: Tue, 18 Jul 2017 17:55:41 +0300 Message-ID: <83a841dcb6.fsf@gnu.org> References: <83tw35thxw.fsf@gnu.org> <87tw35cc70.fsf@rosalinde> <83injktb9p.fsf@gnu.org> <87k240xhk6.fsf@rosalinde> <87k236vh7p.fsf_-_@rosalinde> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1500389968 368 195.159.176.226 (18 Jul 2017 14:59:28 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 18 Jul 2017 14:59:28 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stephen Berman Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jul 18 16:59:22 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dXTxw-0007cb-9o for ged-emacs-devel@m.gmane.org; Tue, 18 Jul 2017 16:59:12 +0200 Original-Received: from localhost ([::1]:57029 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dXTy0-0005nT-5H for ged-emacs-devel@m.gmane.org; Tue, 18 Jul 2017 10:59:16 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42720) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dXTuV-0002xe-9W for emacs-devel@gnu.org; Tue, 18 Jul 2017 10:55:40 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dXTuS-0000Fo-19 for emacs-devel@gnu.org; Tue, 18 Jul 2017 10:55:39 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:53869) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dXTuR-0000Fh-SV; Tue, 18 Jul 2017 10:55:35 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:1224 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1dXTuQ-00077K-Bt; Tue, 18 Jul 2017 10:55:35 -0400 In-reply-to: <87k236vh7p.fsf_-_@rosalinde> (message from Stephen Berman on Tue, 18 Jul 2017 00:20:10 +0200) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:216840 Archived-At: > From: Stephen Berman > Cc: emacs-devel@gnu.org > Date: Tue, 18 Jul 2017 00:20:10 +0200 > > > By that reasoning, line-number-mode (the %l construct) should be changed > > so as not to display a number when point is at EOB. Perhaps it should > > display "EOB" or "END" instead. > > I attempted to implement this change in the mode line display (see > attached patch) and the result, while admittedly only "minor aesthetic > sugar", seems to me not too bad: it makes line-number-mode consistent > not only with vertically displayed line numbers but also with > `count-words-region' (and hence with `count-lines'). What do others > think? Hmm... I don't understand why you needed to change the format spec to %l, and also why the change in mode_line_update_needed. Isn't it enough to just produce "EOB" instead of a number? > static bool > mode_line_update_needed (struct window *w) > { > - return (w->column_number_displayed != -1 > - && !(PT == w->last_point && !window_outdated (w)) > - && (w->column_number_displayed != current_column ())); > + return ((w->column_number_displayed != -1 > + && !(PT == w->last_point && !window_outdated (w)) > + && (w->column_number_displayed != current_column ())) > + || (line_number_displayed > + && ((ZV == w->last_point && PT != ZV) > + || (ZV != w->last_point && PT == ZV)))); The last 2 lines can be written more succinctly as && ((ZV == w->last_point) != (PT == ZV))