From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Stephen Berman Newsgroups: gmane.emacs.devel Subject: Re: line-number-mode at EOB Date: Tue, 18 Jul 2017 18:33:08 +0200 Message-ID: <87zic1aenv.fsf@rosalinde> References: <83tw35thxw.fsf@gnu.org> <87tw35cc70.fsf@rosalinde> <83injktb9p.fsf@gnu.org> <87k240xhk6.fsf@rosalinde> <87k236vh7p.fsf_-_@rosalinde> <83a841dcb6.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1500395614 13497 195.159.176.226 (18 Jul 2017 16:33:34 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 18 Jul 2017 16:33:34 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jul 18 18:33:30 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 1dXVR5-0002vS-6C for ged-emacs-devel@m.gmane.org; Tue, 18 Jul 2017 18:33:23 +0200 Original-Received: from localhost ([::1]:57751 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dXVRA-00065o-RN for ged-emacs-devel@m.gmane.org; Tue, 18 Jul 2017 12:33:28 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54155) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dXVR0-00064h-AX for emacs-devel@gnu.org; Tue, 18 Jul 2017 12:33:19 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dXVQz-0003Pm-5u for emacs-devel@gnu.org; Tue, 18 Jul 2017 12:33:18 -0400 Original-Received: from mout.gmx.net ([212.227.15.19]:57741) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dXVQt-0003Kh-Ha; Tue, 18 Jul 2017 12:33:11 -0400 Original-Received: from rosalinde ([83.135.16.220]) by mail.gmx.com (mrgmx001 [212.227.17.190]) with ESMTPSA (Nemesis) id 0M4GRv-1dp2W60kXD-00rl5O; Tue, 18 Jul 2017 18:33:09 +0200 In-Reply-To: <83a841dcb6.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 18 Jul 2017 17:55:41 +0300") X-Provags-ID: V03:K0:M3PzIr5roMYVTsFR2w5AoX9nJbB+k/DTGrwIMrWWhVAFJwRGppV Sg1OC5zVun4SQGkvwXjebLSop8bS8wzDkRzIVJacJrzHYt0LM0l0a0Ve3+P1MAyowuic2pq p0DnMxiJUB39SeNPtjCM4riAcG7RVAEGVrw8aD5FcJXwNZ2P1csrhgxNvfpVpH8c+wWABNs dgojuN1ttL+Co5JWYCqjA== X-UI-Out-Filterresults: notjunk:1;V01:K0:v1P/xPI/RLo=:xObG+dpTSQDOa00gVvmSrv FZu5mytYb45TZV12UpKhPnMmdQCxJ0qQrhkJdiQ1XI21gzZuo9Cc+YREe2Pvl2wmQQT77Uscm gkQwHv6+z0VwEMzuYWdYiEz5st07XRZr0Ri552UQwgs6j6GdFXg7EKYR5lZvgr/YC+xb6ZVqr BPnVxSsc8m2pr2cCueCoykaa1Y4JvrW9eBpTmPsfPE4ef9l20COshKm/gTkJax/wZht/0mtVO 3iDvUzL6BiJLHn4Ygj1CRilC51jQ9dRsb0ONKm02EM88j5/LvCNKe1PQfvzLZRNXhJE10pwmZ nwP3N9OLxpIRl27bSx0AB/JRuoSEgjDV8S8f++rF7Wv0s4e4Wiybl4gB23GFUw3icuCieuZoY 6iIJcPlMvspUR30fwLtUJyD+w5e8+v1LZr2mL17uGkig0N3NxCQVuCeUDtnLfbRccja1wB7tr GMaEAX2Rgax26axEI882aM4PVgn1nASclbWIAQSF5pOUBMj23SOG9vohPrrpAbCF5tUFyXsfs eeDdZz92CLZ2pDCXG0ZX0/Oxwj2h7N5NCYfBi99IMQpV/UpHNyuS6irZdtB9sowT7Oa4IeSTh 8sJYKJSl2+yXh8+sIQKvsr3IVnkzP66aXCY5OdgXq2uGlIvcTLYZ588syZxHCWMqrdfnacLuB OfaMOe1wgEaIiYlVon5rOd+wnhsEqVU3dHsV0WDw//H2PwBWRHAZel8tjCiAAIQCuDIVn3AqT e7RBKJnNzvJxw4fPqI6QmEcsBMSzeugPeA4WRkgVpMiQWQCUCqGqFKa+A0Rn2SCtVffOCETS X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 212.227.15.19 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:216849 Archived-At: On Tue, 18 Jul 2017 17:55:41 +0300 Eli Zaretskii wrote: >> 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? If just mode-line-position in bindings.el is changed, that fails to update the mode line frequently enough: if you go to point-max in *scratch*, so the mode line displays "EOB", then continually typing C-b or C-p doesn't change the "EOB". Conversely, if just decode_mode_spec is changed to output "EOB" at point-max, the current code in mode-line-position will make the mode line display "LEOB" when column-number-mode is disabled. Finally, even with both of the other changes, without the change in mode_line_update_needed, if the character immediately before EOB is not a newline (and column-number-mode is not enabled), then if point is at EOB, continually typing C-b will keep displaying "EOB" until the line number changes, and if point in on the last line but before EOB, typing C-f to move to EOB will not change the display to "EOB". >> 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)) Thanks! (I felt sure there was a shorter equivalent expression, but it was late when I posted and I couldn't get my head around it.) Steve Berman