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: Mon, 17 Jul 2017 14:34:17 -0600 Message-ID: <87pocyiz06.fsf@lylat> References: <83k23jl5ra.fsf@gnu.org> <87r2xqo8p7.fsf@lylat> <83lgnxk7v6.fsf@gnu.org> <87shi5jk2w.fsf@lylat> <83lgnwi3k3.fsf@gnu.org> <87a84crq31.fsf@lylat> <834lujj9d5.fsf@gnu.org> <87pod67lgi.fsf@lylat> <83fue1iur9.fsf@gnu.org> <87d190j0tz.fsf@lylat> <83h8yceal3.fsf@gnu.org> <871spgrxef.fsf@lylat> <83poczcdlz.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1500323706 27052 195.159.176.226 (17 Jul 2017 20:35:06 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 17 Jul 2017 20:35:06 +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 Mon Jul 17 22:35:02 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 1dXCjK-0006Rh-CL for ged-emacs-devel@m.gmane.org; Mon, 17 Jul 2017 22:34:58 +0200 Original-Received: from localhost ([::1]:52456 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dXCjM-000635-HK for ged-emacs-devel@m.gmane.org; Mon, 17 Jul 2017 16:35:00 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37267) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dXCjC-00060y-JM for emacs-devel@gnu.org; Mon, 17 Jul 2017 16:34:54 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dXCj6-0004IK-Bd for emacs-devel@gnu.org; Mon, 17 Jul 2017 16:34:50 -0400 Original-Received: from mail-it0-x22b.google.com ([2607:f8b0:4001:c0b::22b]:38843) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dXCj6-0004Et-45; Mon, 17 Jul 2017 16:34:44 -0400 Original-Received: by mail-it0-x22b.google.com with SMTP id h199so3323288ith.1; Mon, 17 Jul 2017 13:34:42 -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=4i2w4wbf7UWd497wUuNMa+gEBZ/cjKQnbAWCysIclg0=; b=hcEnl6i3FYYJtEfZNYvcy0Ak4GYhEw+HMbmTJJP1joTIkQH6ze5lY/a97vZ0KQnIdZ TR+cryJziDofnMWyBT8roi64rULeVih7PwPEKaobX6cFDhGxgccebm115m6Krx0QF/T0 TAOlbI8DY/IueoyxX8sPICd80kkqoe/hgJOnkoGVJpAnY/lhphrb7w6Lt/irxfxpygOF V4CV4ddOx4JAyNTapxcGpSf1OmWR+tQ56lyP+Zebw3ViiOszDPG+E2wri4vufhMo0mI4 i3pWOQtkPnGANvQ4sWDyRSITaAvEulwPH7SoSIWNdLrytBT5ylPhLdMeVejr03NJkfK7 xMVw== 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=4i2w4wbf7UWd497wUuNMa+gEBZ/cjKQnbAWCysIclg0=; b=Xhvzujv4F363jT6XMXrlGNf++pOUp/F/gz6HZLbAgcAzUJ4KRiH/hbKIXafoXq+4LQ iaVNpNDFaGej42eD4lP7Q9V4HAL9Y5hMJtfXcyeckemauFoyhG0tF0tW3hrC7/EDpRSL slqlObbV9n1pQy1u/8NsVJB+0PeF6Wil5Au3NTnV/liVgPjFE5f/Rdsz9znKfGYrpa3j ZMbOujVwugVSWW0aVkwO2yoPVfN+sUQU5zROzWulDj7RA2fCcK2AZ2Swir/1BlzV6Ukh nBAXCFIeGc8sgXRFeEVyvJFFl9aDNxcHUB+MusTqAUyLww+z7EoiDv3LAahaaNkHBRRU kwNg== X-Gm-Message-State: AIVw110hy1ivPWtpp+15151pHmhmsFVxtuL33zgEJnlb+b1CdK9zmMMd MuBDZUD0PsryIdQ3 X-Received: by 10.36.60.204 with SMTP id m195mr2264108ita.3.1500323681254; Mon, 17 Jul 2017 13:34:41 -0700 (PDT) Original-Received: from lylat (S010664777d9cebe3.ss.shawcable.net. [70.64.85.59]) by smtp.gmail.com with ESMTPSA id 66sm105449ioj.47.2017.07.17.13.34.39 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 Jul 2017 13:34:39 -0700 (PDT) In-Reply-To: <83poczcdlz.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 17 Jul 2017 18:00:40 +0300") X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4001:c0b::22b 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:216800 Archived-At: --=-=-= Content-Type: text/plain Eli Zaretskii writes: >> From: Alex >> Cc: emacs-devel@gnu.org >> Date: Sun, 16 Jul 2017 13:31:52 -0600 >> >> > All else being equal, I think having as much as possible in >> > display-line-numbers.el would be better, as it avoids scattering >> > related stuff across different files. >> >> I agree. Here's an updated patch that includes this as well as other >> improvements: > > LGTM, thanks. How about updating the manual and NEWS as well? Sure, I've done that in [1]. I've also fixed a DEFSYM issue that was caused by the rename from display-line-number-width to display-line-numbers-width in patch [2] Footnotes: [1] --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Document-display-line-numbers-mode.patch Content-Description: document >From 7a9aacd3a4d5f0a98050502f624aea3cbb4e6ce0 Mon Sep 17 00:00:00 2001 From: Alexander Gramiak Date: Mon, 17 Jul 2017 14:14:45 -0600 Subject: [PATCH] Document display-line-numbers-mode * doc/emacs/custom.texi (Init Rebinding): Re-add entry that used to belong to linum-mode. * doc/emacs/modes.texi (Minor Modes): Summarize the mode. * etc/NEWS: Document display-line-numbers-mode and its customization variables, and mention that display-line-numbers-width is buffer-local. --- doc/emacs/custom.texi | 1 + doc/emacs/modes.texi | 7 +++++++ etc/NEWS | 44 +++++++++++++++++++++++++++++--------------- 3 files changed, 37 insertions(+), 15 deletions(-) diff --git a/doc/emacs/custom.texi b/doc/emacs/custom.texi index a756a89e3f..1c9c14a962 100644 --- a/doc/emacs/custom.texi +++ b/doc/emacs/custom.texi @@ -1701,6 +1701,7 @@ Init Rebinding (global-set-key (kbd "C-c y") 'clipboard-yank) (global-set-key (kbd "C-M-q") 'query-replace) (global-set-key (kbd "") 'flyspell-mode) +(global-set-key (kbd "C-") 'display-line-numbers-mode) (global-set-key (kbd "C-") 'forward-sentence) (global-set-key (kbd "") 'mouse-save-then-kill) @end example diff --git a/doc/emacs/modes.texi b/doc/emacs/modes.texi index eb0c88b290..876431aa9e 100644 --- a/doc/emacs/modes.texi +++ b/doc/emacs/modes.texi @@ -225,6 +225,13 @@ Minor Modes programs. It is enabled globally by default, but you can disable it in individual buffers. @xref{Faces}. +@findex display-line-numbers-mode +@cindex display-line-numbers-mode +@item +Display Line Numbers mode is a convenience wrapper around +@code{display-line-numbers}, setting it using the value of +@code{display-line-numbers-type}. @xref{Display Custom}. + @item Outline minor mode provides similar facilities to the major mode called Outline mode. @xref{Outline Mode}. diff --git a/etc/NEWS b/etc/NEWS index edb71118ef..ccc9984c4c 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -424,13 +424,18 @@ range of indentation. This is similar to what linum-mode provides, but much faster and doesn't usurp the display margin for the line numbers. Customize the buffer-local variable 'display-line-numbers' to activate this optional -display. If set to t, Emacs will display the number of each line -before the line. If set to 'relative', Emacs will display the line -number relative to the line showing point, with that line's number -displayed as absolute. If set to 'visual', Emacs will display a -relative number for every screen line, i.e. it will count screen lines -rather than buffer lines. The default is nil, which doesn't display -the line numbers. +display. Alternatively, you can use the `display-line-numbers-mode' +minor mode or the global `global-display-line-numbers-mode'. When +using these modes, customize `display-line-numbers-type' with the same +value as you would use with `display-line-numbers'. + +If `display-line-numbers' is set to t, Emacs will display the number +of each line before the line. If set to 'relative', Emacs will +display the line number relative to the line showing point, with that +line's number displayed as absolute. If set to 'visual', Emacs will +display a relative number for every screen line, i.e. it will count +screen lines rather than buffer lines. The default is nil, which +doesn't display the line numbers. In 'relative' and 'visual' modes, the variable 'display-line-numbers-current-absolute' controls what number is @@ -448,14 +453,23 @@ new face 'line-number-current-line' can be customized to display the current line's number differently from all the other line numbers; by default these two faces are identical. -You can also customize the new variable 'display-line-numbers-width' to -specify a fixed minimal with of the area allocated to line-number -display. The default is nil, meaning that Emacs will dynamically -calculate the area width, enlarging or shrinking it as needed. -Setting it to a non-negative integer specifies that as the minimal -width; selecting a value that is large enough to display all line -numbers in a buffer will then keep the line-number display area of -constant width at all times, if that is desired. +You can also customize the new buffer-local variable +'display-line-numbers-width' to specify a fixed minimal with of the +area allocated to line-number display. The default is nil, meaning +that Emacs will dynamically calculate the area width, enlarging or +shrinking it as needed. Setting it to a non-negative integer +specifies that as the minimal width; selecting a value that is large +enough to display all line numbers in a buffer will then keep the +line-number display area of constant width at all times, if that is +desired. + +When using `display-line-numbers-mode', you can customize the variable +`display-line-numbers-grow-only' to a non-nil value; this means that +Emacs may grow the above area width dynamically, but never shrink it. +Under this mode, customizing the variable +`display-line-numbers-width-start' to a non-nil value will cause Emacs +to set `display-line-numbers-width' to the minimum width necessary to +display all line numbers in the current buffer when first visiting it. Lisp programs can disable line-number display for a particular screen line by putting the 'display-line-numbers-disable' text property or -- 2.13.2 --=-=-= Content-Type: text/plain [2] --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-src-xdisp.c-syms_of_xdisp-Fix-renaming-omission.patch Content-Description: rename >From 1d85de761577540ba5a85a39d91f6b3cf221b948 Mon Sep 17 00:00:00 2001 From: Alexander Gramiak Date: Mon, 17 Jul 2017 14:12:24 -0600 Subject: [PATCH] * src/xdisp.c (syms_of_xdisp): Fix renaming omission --- src/xdisp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/xdisp.c b/src/xdisp.c index 2aceb89c00..5e594347f0 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -32718,7 +32718,7 @@ even if the actual number needs less space. The default value of nil means compute the space dynamically. Any other value is treated as nil. */); Vdisplay_line_numbers_width = Qnil; - DEFSYM (Qdisplay_line_numbers_width, "display-line-number-width"); + DEFSYM (Qdisplay_line_numbers_width, "display-line-numbers-width"); Fmake_variable_buffer_local (Qdisplay_line_numbers_width); DEFVAR_LISP ("display-line-numbers-current-absolute", -- 2.13.2 --=-=-=--