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: Native display of line numbers, improved Date: Mon, 26 Jun 2017 18:56:03 +0300 Message-ID: <83efu6spyk.fsf@gnu.org> References: <83tw35thxw.fsf@gnu.org> <87efu7lsj0.fsf@lylat> <83r2y7sc9q.fsf@gnu.org> <87a84vl8gm.fsf@lylat> <83podqsst5.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1498492634 18723 195.159.176.226 (26 Jun 2017 15:57:14 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 26 Jun 2017 15:57:14 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jun 26 17:57:10 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 1dPWNw-0004bi-0C for ged-emacs-devel@m.gmane.org; Mon, 26 Jun 2017 17:57:08 +0200 Original-Received: from localhost ([::1]:47316 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dPWO1-00007n-28 for ged-emacs-devel@m.gmane.org; Mon, 26 Jun 2017 11:57:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40458) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dPWNA-00006p-6j for emacs-devel@gnu.org; Mon, 26 Jun 2017 11:56:21 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dPWN5-0005eM-95 for emacs-devel@gnu.org; Mon, 26 Jun 2017 11:56:20 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:35345) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dPWN5-0005eD-6A; Mon, 26 Jun 2017 11:56:15 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:3508 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1dPWN4-0002kn-Gx; Mon, 26 Jun 2017 11:56:14 -0400 In-reply-to: (message from Stefan Monnier on Mon, 26 Jun 2017 11:28:23 -0400) 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:215999 Archived-At: > From: Stefan Monnier > Date: Mon, 26 Jun 2017 11:28:23 -0400 > > I don't understand your comment: Alex is referring here to the approach > used in nlinum, which I chose specifically to avoid having to scan the > whole buffer. I alluded to this: > that can > be worked around by setting 'display-line-number-width' to a > sufficiently large number, but I would like it to be no larger than what > it needs to be for the current text in the buffer. I provided 'display-line-number-width' to cater to the desire of not shrinking the width too much, and it seemed to me that if someone's ideal is not to change the width at all, as Alex said up-thread, counting the lines at the beginning will do that for him. > Basically, start with a small value of display-line-number-width, and if > during display we find that this value is too small to fit the largest > displayed line-number, we increase it. I wanted to avoid using a buffer-local variable settable by the display engine. (I cannot easily use display-line-number-width, because that's a user-settable option; I need another variable.)