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 line numbers landed on master Date: Tue, 11 Jul 2017 18:12:22 +0300 Message-ID: <834lujj9d5.fsf@gnu.org> References: <83k23jl5ra.fsf@gnu.org> <87r2xqo8p7.fsf@lylat> <83lgnxk7v6.fsf@gnu.org> <87shi5jk2w.fsf@lylat> <83lgnwi3k3.fsf@gnu.org> <87a84crq31.fsf@lylat> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1499786011 19785 195.159.176.226 (11 Jul 2017 15:13:31 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 11 Jul 2017 15:13:31 +0000 (UTC) Cc: emacs-devel@gnu.org To: Alex Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jul 11 17:13:26 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 1dUwqc-0004D7-1T for ged-emacs-devel@m.gmane.org; Tue, 11 Jul 2017 17:13:10 +0200 Original-Received: from localhost ([::1]:46938 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dUwqh-0003nF-Fm for ged-emacs-devel@m.gmane.org; Tue, 11 Jul 2017 11:13:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54429) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dUwpy-0003mw-Rv for emacs-devel@gnu.org; Tue, 11 Jul 2017 11:12:31 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dUwpv-0004hB-Mn for emacs-devel@gnu.org; Tue, 11 Jul 2017 11:12:30 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:35505) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dUwpv-0004h7-J9; Tue, 11 Jul 2017 11:12:27 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:1293 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1dUwpv-0006vF-2Q; Tue, 11 Jul 2017 11:12:27 -0400 In-reply-to: <87a84crq31.fsf@lylat> (message from Alex on Mon, 10 Jul 2017 14:31:46 -0600) 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:216480 Archived-At: > From: Alex > Cc: emacs-devel@gnu.org > Date: Mon, 10 Jul 2017 14:31:46 -0600 > > >> +(defgroup display-line-numbers nil > >> + "Display line numbers in the buffer." > >> + :group 'display) > > > > This means the defcustoms here will be separate from those defined in > > cus-start.el. Is that intended? > > > > More generally, do we want some of the defcustoms to live here and > > some in another file? And if we want all of them here, does that mean > > this file needs to be preloaded, or at least auto-loaded when > > display-line-numbers is set by the user? > > I'm not sure if there's a convention for this (built-in feature with a > Lisp-level mode wrapper) situation, but it might be nice to separate the > variables that are directly linked to display-line-numbers and ones that > only are used in the minor mode wrapper. > > What about defining the defgroup in cus-edit.el, making both these > variables and the ones in cus-start belong to it? Sounds OK to me, thanks. I think we do want all the variables to appear in the same customization group, even if they are defined separately. Maybe also add a comment in display-line-numbers.el that some additional defcustoms are defined in cus-start.el. > I don't know if the file should be pre/auto-loaded. Is there a reason to > do so considering linum.el isn't? linum.el _is_ autoloaded if you invoke linum-mode, no? The scenario I had in mind was a user doing this: M-x set-variable RET display-line-numbers RET t RET This is a legitimate way of activating the feature in a buffer. Do we want then the user to automatically have access to all the customizations and features in display-line-numbers.el? > >> +(define-globalized-minor-mode global-display-line-numbers-mode > >> + display-line-numbers-mode > >> + (lambda () > >> + (unless (or (minibufferp) > >> + ;; taken from linum.el > >> + (and (daemonp) (null (frame-parameter nil 'client)))) > >> + (display-line-numbers-mode)))) > > > > The daemonp part is only needed when display-line-number-width-start > > is non-nil, right? > > I suppose so, but would one want line numbers in that specific buffer > either way? I don't know. Similarity to interactive invocation, maybe? > I added that part because you added it to linum.el in bd3c6eec. That was to fix a bug that I think shouldn't happen with the native implementation, because it doesn't count lines. > Does the problem affect display-line-numbers? I don't think so, but it should be easy to test. I'll take a look. > Also, I was wondering if setting display-line-number-width in > pre-command-hook unconditionally is a good idea. I timed it and the > function itself seemed slightly faster than a let/when approach, but > describe-variable states that setting it calls set-buffer-redisplay, > which disables redisplay optimizations. So if I understand this > correctly, adding the current display-line-numbers-update-width to > pre-command-hook would disable redisplay optimizations for every > command. Yes, it shouldn't be unconditional. > P.S. I also noticed that the docstring for display-line-numbers doesn't > describe the 'relative value, or state that 'visual also uses relative > line numbers. Thanks, I fixed this.