From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: Native display of line numbers Date: Sat, 17 Jun 2017 20:27:02 +0000 Message-ID: <20170617202702.GC2955@acm.fritz.box> References: <83lgoqzm0v.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1497731342 7132 195.159.176.226 (17 Jun 2017 20:29:02 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 17 Jun 2017 20:29:02 +0000 (UTC) User-Agent: Mutt/1.5.24 (2015-08-30) Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Jun 17 22:28:56 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 1dMKKz-0001Kr-93 for ged-emacs-devel@m.gmane.org; Sat, 17 Jun 2017 22:28:53 +0200 Original-Received: from localhost ([::1]:36180 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dMKL3-00079a-N5 for ged-emacs-devel@m.gmane.org; Sat, 17 Jun 2017 16:28:57 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58327) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dMKKN-00079Q-7I for emacs-devel@gnu.org; Sat, 17 Jun 2017 16:28:16 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dMKKI-0006mY-5Z for emacs-devel@gnu.org; Sat, 17 Jun 2017 16:28:15 -0400 Original-Received: from ocolin.muc.de ([193.149.48.4]:29819 helo=mail.muc.de) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1dMKKH-0006ls-Px for emacs-devel@gnu.org; Sat, 17 Jun 2017 16:28:10 -0400 Original-Received: (qmail 27257 invoked by uid 3782); 17 Jun 2017 20:28:08 -0000 Original-Received: from acm.muc.de (p548C72DB.dip0.t-ipconnect.de [84.140.114.219]) by colin.muc.de (tmda-ofmipd) with ESMTP; Sat, 17 Jun 2017 22:28:07 +0200 Original-Received: (qmail 23734 invoked by uid 1000); 17 Jun 2017 20:27:02 -0000 Content-Disposition: inline In-Reply-To: <83lgoqzm0v.fsf@gnu.org> X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x [fuzzy] X-Received-From: 193.149.48.4 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:215715 Archived-At: Hello, Eli. On Sat, Jun 17, 2017 at 18:12:00 +0300, Eli Zaretskii wrote: > I generally consider display of line numbers for each line in the > buffer un-Emacsy, something that came from the dark era when we needed > to count lines to be able to tell the then existing editors something > like "move down N lines, then DO SOMETHING". Emacs pioneered today's > world where all this is unnecessary, and the rest is history. > However, many users want line numbers to be displayed in Emacs. I > don't know why they want it, perhaps they were "spoiled" by other IDEs > or something. I'm not sure either. One possible use is when using a build process disjoint from Emacs which gives error and warning messages on a terminal. It may be easier to find the pertinent lines if the line numbers are displayed prominently. But this is speculation, nothing more. > In any case, given the popularity of the various add-on modes which > insist on displaying line numbers using all kinds of tricks, I don't > think we can ignore this tendency any longer, even if we agree that > this is a disease. The "epidemic" has spread too far and too wide for > us to continue looking the other way. And since Emacs doesn't make it > easy for a Lisp program to invade the holy realm of redisplay, those > modes use tricks that make Emacs slower and frequently interfere with > other packages. They also make demands on the display engine that > make Emacs harder to develop and maintain. Yes to all of that. > So with that in mind, I came up with an implementation of a native > display of line numbers. You can find it in the scratch/line-numbers > branch of the Emacs repository. Compared with linum-mode, > nlinum-mode, and other similar modes, it has the following main > advantages: > . it works significantly faster (almost twice as fast as linum-mode, > 50% faster that relative-line-numbers-mode) > . it doesn't use the display margins > . it works with R2L text, something the old modes never did And, for me, the display engine is simply the Right Place to implement these line numbers. > The main features of the line-numbering modes are all supported by > this new feature. > Please give it a try and report any bugs you find. I'm sure there > will be quite a few bugs, given the sheer amount of display feature > which could be affected, and which I didn't have time to test. Just one or two minor irritations: it's not clear what face the line numbers are displayed with; presumably this will become a defcustom in the finished version. Also, it's not clear what "relative" line numbers are, though I dare say it would become clear if I actually tried it (and I admit I haven't tried RTFM). ;-) > Once the flood of serious bug reports dries out, I will look into > merging this to master. If, miraculously, no such flood arrives, I > will merge in a couple of weeks. When that happens, we will declare > all the other modes which do the same job deprecated. I'm in favour of this. > TIA -- Alan Mackenzie (Nuremberg, Germany).