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 Date: Sat, 24 Jun 2017 00:04:51 +0300 Message-ID: <8360fmv2j0.fsf@gnu.org> References: <83lgoqzm0v.fsf@gnu.org> <83injouj5v.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1498251976 5458 195.159.176.226 (23 Jun 2017 21:06:16 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 23 Jun 2017 21:06:16 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jun 23 23:06:07 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 1dOVmI-0000m2-UG for ged-emacs-devel@m.gmane.org; Fri, 23 Jun 2017 23:06:07 +0200 Original-Received: from localhost ([::1]:37254 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dOVmK-0001qs-W7 for ged-emacs-devel@m.gmane.org; Fri, 23 Jun 2017 17:06:09 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44486) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dOVlS-0001ph-5e for emacs-devel@gnu.org; Fri, 23 Jun 2017 17:05:15 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dOVlN-0003y3-7G for emacs-devel@gnu.org; Fri, 23 Jun 2017 17:05:14 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:52364) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dOVlN-0003xj-3n; Fri, 23 Jun 2017 17:05:09 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:1291 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1dOVlM-0005JJ-Cy; Fri, 23 Jun 2017 17:05:08 -0400 In-reply-to: (message from Stefan Monnier on Fri, 23 Jun 2017 12:23:06 -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:215915 Archived-At: > From: Stefan Monnier > Date: Fri, 23 Jun 2017 12:23:06 -0400 > > > Anyway, implementing this will need to code a whole different method > > of counting lines (the current branch just reuses the same code which > > produces the line numbers in the mode line), so I will need to > > experiment to see if it can be implemented fast enough to avoid > > slowing down redisplay, which is already slower in folded buffers. > > Indeed, to make it fast enough it probably needs to count lines using > the matrices rather than the buffer. No, I cannot use the glyph matrices, because the line numbers are generated when the glyph matrix is created, and because the previous matrix cannot be trusted in general. I need to use the move_it_in_display_line_to and its ilk instead. > That should actually make it faster than absolute line numbers (at > least in large buffers). I'm not sure. I actually fear it's the other way around, because counting logical lines is implemented by fast code using memchr, whereas move_it_in_display_line_to must move one character at a time. But it could well be that this is fast enough, especially since relative line numbers never need us to go more than one window-full away.