From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#28246: display line number width != length of line number at eob Date: Mon, 28 Aug 2017 20:27:46 +0300 Message-ID: <83a82j4n71.fsf@gnu.org> References: Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1503941352 7056 195.159.176.226 (28 Aug 2017 17:29:12 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 28 Aug 2017 17:29:12 +0000 (UTC) Cc: 28246@debbugs.gnu.org To: Keith David Bershatsky Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Aug 28 19:29:07 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1dmNqS-0001Tw-TG for geb-bug-gnu-emacs@m.gmane.org; Mon, 28 Aug 2017 19:29:05 +0200 Original-Received: from localhost ([::1]:40787 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dmNqZ-0001CC-U0 for geb-bug-gnu-emacs@m.gmane.org; Mon, 28 Aug 2017 13:29:11 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57620) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dmNqU-0001Bv-1h for bug-gnu-emacs@gnu.org; Mon, 28 Aug 2017 13:29:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dmNqQ-00012t-Rd for bug-gnu-emacs@gnu.org; Mon, 28 Aug 2017 13:29:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:50925) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dmNqQ-00012n-OH for bug-gnu-emacs@gnu.org; Mon, 28 Aug 2017 13:29:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dmNqQ-0003ef-Fd for bug-gnu-emacs@gnu.org; Mon, 28 Aug 2017 13:29:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 28 Aug 2017 17:29:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 28246 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 28246-submit@debbugs.gnu.org id=B28246.150394129913994 (code B ref 28246); Mon, 28 Aug 2017 17:29:02 +0000 Original-Received: (at 28246) by debbugs.gnu.org; 28 Aug 2017 17:28:19 +0000 Original-Received: from localhost ([127.0.0.1]:59605 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dmNpi-0003de-Ni for submit@debbugs.gnu.org; Mon, 28 Aug 2017 13:28:18 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:38283) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dmNpg-0003dR-Gl for 28246@debbugs.gnu.org; Mon, 28 Aug 2017 13:28:16 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dmNpX-0000lg-Cv for 28246@debbugs.gnu.org; Mon, 28 Aug 2017 13:28:11 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:49673) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dmNpX-0000la-96; Mon, 28 Aug 2017 13:28:07 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:4288 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1dmNpV-0004do-Kl; Mon, 28 Aug 2017 13:28:07 -0400 In-reply-to: (message from Keith David Bershatsky on Sun, 27 Aug 2017 18:46:42 -0700) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 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: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:136298 Archived-At: > Date: Sun, 27 Aug 2017 18:46:42 -0700 > From: Keith David Bershatsky > Cc: 28246@debbugs.gnu.org > > I do not know whether any other Emacs users would appreciate *precision* width based upon the length of the last line in the buffer. You are the first to raise this issue, and frankly I still don't understand why it's important to you. > Inasmuch as I was hoping to achieve *precision* width every command loop, display-line-numbers-width-start and/or display-line-numbers-grow-only would not suffice in that regard. I am uncertain why it->lnum_width is *not* always equal to > > (save-excursion > (goto-char (point-max)) > (length (format-mode-line "%l")) Because we only make the line-number display as wide as needed for line numbers seen so far, while the Lisp above wants to make it as wide as required by the last line in the buffer. You can get the same with the above customization variables if you visit the bottom of the buffer just once. > linum.el is slow in large buffers primarily because it uses count-lines. In an emacs.stackexchange.com thread entitled "A faster method to obtain `line-number-at-pos` in large buffers" -- https://emacs.stackexchange.com/q/3821/2287 -- I learned that format-mode-line with the "%l" argument can be used to greatly enhance speed versus using count-lines. However, the window must be visible and some other limitations apply as discussed in the comments of the SE thread. As that discussion reveals, this method is not 100% reliable in practice. Anyway, is there anything else to do in this bug report, or can we close it?