From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Alex Newsgroups: gmane.emacs.devel Subject: Re: Native line numbers landed on master Date: Sat, 08 Jul 2017 16:38:44 -0600 Message-ID: <87r2xqo8p7.fsf@lylat> References: <83k23jl5ra.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1499553586 1665 195.159.176.226 (8 Jul 2017 22:39:46 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 8 Jul 2017 22:39:46 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jul 09 00:39:39 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 1dTyO0-0008Da-Ee for ged-emacs-devel@m.gmane.org; Sun, 09 Jul 2017 00:39:36 +0200 Original-Received: from localhost ([::1]:34226 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dTyO2-0007wo-KM for ged-emacs-devel@m.gmane.org; Sat, 08 Jul 2017 18:39:38 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44151) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dTyNS-0007wP-GO for emacs-devel@gnu.org; Sat, 08 Jul 2017 18:39:03 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dTyNP-0008T1-Ct for emacs-devel@gnu.org; Sat, 08 Jul 2017 18:39:02 -0400 Original-Received: from mail-io0-x22a.google.com ([2607:f8b0:4001:c06::22a]:35941) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dTyNP-0008Sr-6i; Sat, 08 Jul 2017 18:38:59 -0400 Original-Received: by mail-io0-x22a.google.com with SMTP id z62so10794152ioi.3; Sat, 08 Jul 2017 15:38:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=82nrBMPgESYh0czbol8n2OQW79nOonPQBDPHdOMwp4A=; b=qsRhyDbgpKMbvgpb2eWqn2hT91WB4voe0j6D5czm4PE/Ia+L+9IUceRwF8sf3JLgLi nLKGaPUuaDvqTSqhuoUc3bMASgw2ePtQGfmjm/yD62NaB3m0qjjQG6SCIqHogjluAK9y 4DuTShbYrxVFPBeb89IVtx2aNhQDO2ICNLG7SFif9LiuVg76lvhQPqUfAofNP6JbXELS xLFuG9m5Aj483rGze3PVkFvBH2vJmFLGrrctn4eOAW+hERLv5TdfBmC1yh+zr4s7ZLur HxrpBx/xMK3ClWRl6ZOfXFLBviH1DG7NIDmzbuio3p8tWjAaGyHZqAI7eiwEvAXoTVvh ZU1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=82nrBMPgESYh0czbol8n2OQW79nOonPQBDPHdOMwp4A=; b=WmPq3TlhVHHOA6vpthXpP2KDqe/sapMsQu6+DC7AfiloqfLheVRqE4t5QV+ZWARxrN S7XqRjtAF7MK++RBf8VYx1ktOArTdnx7NCE1n2Gu5L3TzJfEHuhKDz3LhS2OTZtyGDzC +El+tMDBTZ/oIOCw/6rD/Ui09QlRZPwlW7I6okrC+6VN5CTzv7kINwwrHsSxvuQ5/mBo wAHgIXPLxCpqwXI1//a7u5yi1hgWQOc2PU6h/NrUFQZc7CP78eqmnTYIb8Z8wP62sC25 BbGHqDIOjCP1/zQqQXSrifhZKh09PfuilERAERsnyJ0AWEkJBeVerSNaY1DPv+vexJiM fg9A== X-Gm-Message-State: AKS2vOw+7OHB20vNdkUWDFbjDX3QYe6pyB4Osy0dDG9SKNP02TcKfchN SDGM4pBF6vO7L5zC X-Received: by 10.107.135.160 with SMTP id r32mr59881305ioi.73.1499553538086; Sat, 08 Jul 2017 15:38:58 -0700 (PDT) Original-Received: from lylat (S010664777d9cebe3.ss.shawcable.net. [70.64.85.59]) by smtp.gmail.com with ESMTPSA id a65sm3836007ioj.51.2017.07.08.15.38.46 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 08 Jul 2017 15:38:46 -0700 (PDT) In-Reply-To: <83k23jl5ra.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 08 Jul 2017 10:58:17 +0300") X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4001:c06::22a 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:216345 Archived-At: --=-=-= Content-Type: text/plain Eli Zaretskii writes: > I've merged the line-numbers branch into master. Please report any > problems you see as result of this via 'report-emacs-bug', as usual. > > Thanks to everyone who tested the branch and provided feedback. > > I will keep the branch in the repository for a week or so, before > deleting it, to let people who tracked the branch switch to master in > their own free time. Why did you choose the name line-number-display-width over, e.g., display-line-number-width? It seems every other related variable has a prefix of display-. I can see the name being confused with line-number-display-limit-width and line-number-display-limit. P.S. I was thinking about how a minor mode for this should be implemented. I attached a proof of concept, which includes a couple extra variables to achieve line number width behaviour similar to linum/nlinum. What do you think? --=-=-= Content-Type: application/emacs-lisp Content-Disposition: attachment; filename=display-line-numbers.el Content-Transfer-Encoding: quoted-printable ;; toggle-display-line-numbers in menu-bar.el should probably be set to a m= ode (defgroup display-line-numbers nil "Show line numbers in the buffer." :group 'convenience) (defcustom display-line-number-type t "Sets the type of line numbers to use in `display-line-number-mode'. See `display-line-numbers' for value options." :group 'display-line-numbers :type 'symbol) (defcustom display-line-number-inhibit-shrink nil "If non-nil, do not shrink line number width." :group 'display-line-numbers :type 'boolean) (defcustom display-line-number-width-start nil "If non-nil, set initial line number width based on buffer contents. `display-line-number-width' is set to the minimum width necessary to display all line numbers in the buffer." :group 'display-line-numbers :type 'boolean) (defun display-line-numbers-update-width () (setq display-line-number-width (max (or display-line-number-width 1) (line-number-display-width)))) (define-minor-mode display-line-numbers-mode "Toggle display of line numbers in the buffer." :lighter nil (if display-line-numbers-mode (progn (when display-line-number-width-start (setq display-line-number-width (length (number-to-string (count-lines (point-min) (point-max)))))) (when display-line-number-inhibit-shrink (add-hook 'pre-command-hook #'display-line-numbers-update-width n= il t)) (setq display-line-numbers display-line-number-type)) (remove-hook 'pre-command-hook #'display-line-numbers-update-width t) (setq display-line-numbers nil))) (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)))) --=-=-=--