GNU bug report logs - #37120
[PATCH] Prefer display-line-numbers over linum in docs and custom

Previous Next

Package: emacs;

Reported by: Stefan Kangas <stefan <at> marxist.se>

Date: Tue, 20 Aug 2019 17:27:01 UTC

Severity: normal

Tags: patch

Fixed in version 27.1

Done: Stefan Kangas <stefan <at> marxist.se>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 37120 in the body.
You can then email your comments to 37120 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#37120; Package emacs. (Tue, 20 Aug 2019 17:27:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Stefan Kangas <stefan <at> marxist.se>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 20 Aug 2019 17:27:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefan <at> marxist.se>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] Prefer display-line-numbers over linum in docs and custom
Date: Tue, 20 Aug 2019 19:26:02 +0200
[Message part 1 (text/plain, inline)]
NEWS.26 says:

'linum-mode' and all similar packages are henceforth becoming obsolete.
Users and developers are encouraged to switch to this new feature
[i.e. display-line-numbers-mode] instead.

This patch updates the FAQ to recommend display-line-numbers-mode over
linum-mode.  It also changes one defcustom in progmodes in the same
way.

WDYT?  And, if it looks good, should it go to the master branch or emacs-26?

Thanks,
Stefan Kangas

PS. I'm not sure if linum.el should also be moved into lisp/obsolete/
or if that's premature for 27.1.
[0001-Prefer-display-line-numbers-over-linum-in-docs-and-o.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#37120; Package emacs. (Tue, 20 Aug 2019 17:59:02 GMT) Full text and rfc822 format available.

Message #8 received at 37120 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: 37120 <at> debbugs.gnu.org
Subject: Re: bug#37120: [PATCH] Prefer display-line-numbers over linum in docs
 and custom
Date: Tue, 20 Aug 2019 20:58:44 +0300
> From: Stefan Kangas <stefan <at> marxist.se>
> Date: Tue, 20 Aug 2019 19:26:02 +0200
> 
> NEWS.26 says:
> 
> 'linum-mode' and all similar packages are henceforth becoming obsolete.
> Users and developers are encouraged to switch to this new feature
> [i.e. display-line-numbers-mode] instead.
> 
> This patch updates the FAQ to recommend display-line-numbers-mode over
> linum-mode.  It also changes one defcustom in progmodes in the same
> way.

Thanks, but see the comments below.

> WDYT?  And, if it looks good, should it go to the master branch or emacs-26?

It should go to master.

> PS. I'm not sure if linum.el should also be moved into lisp/obsolete/
> or if that's premature for 27.1.

I think it's still premature.

> --- a/doc/misc/efaq.texi
> +++ b/doc/misc/efaq.texi
> @@ -1687,7 +1687,7 @@ Displaying the current line or column
>  this variable.
>  
>  @cindex Set number capability in @code{vi} emulators
> -The @samp{linum} package (distributed with Emacs since version 23.1)
> +@samp{display-line-numbers-mode} (added to Emacs in version 26.1)
>  displays line numbers in the left margin, like the ``set number''
>  capability of @code{vi}.  The packages @samp{setnu} and

This is incorrect: display-line-numbers-mode doesn't use the display
margin (linum.el did).

>  @samp{wb-line-number} (not distributed with Emacs) also implement this
> diff --git a/lisp/progmodes/prog-mode.el b/lisp/progmodes/prog-mode.el
> index cb39e62265..8d3513bad3 100644
> --- a/lisp/progmodes/prog-mode.el
> +++ b/lisp/progmodes/prog-mode.el
> @@ -39,7 +39,8 @@ prog-mode
>  (defcustom prog-mode-hook nil
>    "Normal hook run when entering programming modes."
>    :type 'hook
> -  :options '(flyspell-prog-mode abbrev-mode flymake-mode linum-mode
> +  :options '(flyspell-prog-mode abbrev-mode flymake-mode
> +                                display-line-numbers-mode
>                                  prettify-symbols-mode)

Hmm... is it reasonable to run prog-mode-hook just because someone
turns on line numbers?  It sounds too drastic to me.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#37120; Package emacs. (Tue, 20 Aug 2019 18:20:01 GMT) Full text and rfc822 format available.

Message #11 received at 37120 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefan <at> marxist.se>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 37120 <at> debbugs.gnu.org
Subject: Re: bug#37120: [PATCH] Prefer display-line-numbers over linum in docs
 and custom
Date: Tue, 20 Aug 2019 20:18:49 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

> Thanks, but see the comments below.

Thanks for reviewing this patch.

> > --- a/doc/misc/efaq.texi
> > +++ b/doc/misc/efaq.texi
> > @@ -1687,7 +1687,7 @@ Displaying the current line or column
> >  this variable.
> >
> >  @cindex Set number capability in @code{vi} emulators
> > -The @samp{linum} package (distributed with Emacs since version 23.1)
> > +@samp{display-line-numbers-mode} (added to Emacs in version 26.1)
> >  displays line numbers in the left margin, like the ``set number''
> >  capability of @code{vi}.  The packages @samp{setnu} and
>
> This is incorrect: display-line-numbers-mode doesn't use the display
> margin (linum.el did).

Would "displays line numbers on the left side of the current window"
be more precise?

> > diff --git a/lisp/progmodes/prog-mode.el b/lisp/progmodes/prog-mode.el
> > index cb39e62265..8d3513bad3 100644
> > --- a/lisp/progmodes/prog-mode.el
> > +++ b/lisp/progmodes/prog-mode.el
> > @@ -39,7 +39,8 @@ prog-mode
> >  (defcustom prog-mode-hook nil
> >    "Normal hook run when entering programming modes."
> >    :type 'hook
> > -  :options '(flyspell-prog-mode abbrev-mode flymake-mode linum-mode
> > +  :options '(flyspell-prog-mode abbrev-mode flymake-mode
> > +                                display-line-numbers-mode
> >                                  prettify-symbols-mode)
>
> Hmm... is it reasonable to run prog-mode-hook just because someone
> turns on line numbers?  It sounds too drastic to me.

I'm not sure I understand what you mean.  I thought that this just
means that when running M-x customize-option RET prog-mode-hook RET we
show display-line-numbers-mode instead of linum-mode as an option.  Is
there something I'm missing here?

Best regards,
Stefan Kangas




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#37120; Package emacs. (Wed, 21 Aug 2019 16:49:02 GMT) Full text and rfc822 format available.

Message #14 received at 37120 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: 37120 <at> debbugs.gnu.org
Subject: Re: bug#37120: [PATCH] Prefer display-line-numbers over linum in docs
 and custom
Date: Wed, 21 Aug 2019 19:48:38 +0300
> From: Stefan Kangas <stefan <at> marxist.se>
> Date: Tue, 20 Aug 2019 20:18:49 +0200
> Cc: 37120 <at> debbugs.gnu.org
> 
> > >  @cindex Set number capability in @code{vi} emulators
> > > -The @samp{linum} package (distributed with Emacs since version 23.1)
> > > +@samp{display-line-numbers-mode} (added to Emacs in version 26.1)
> > >  displays line numbers in the left margin, like the ``set number''
> > >  capability of @code{vi}.  The packages @samp{setnu} and
> >
> > This is incorrect: display-line-numbers-mode doesn't use the display
> > margin (linum.el did).
> 
> Would "displays line numbers on the left side of the current window"
> be more precise?

I'd prefer "displays line numbers in the text area, before each line".
("Left side" is not entirely accurate, because in R2L paragraphs the
numbers are displayed on the right.)

> > >  (defcustom prog-mode-hook nil
> > >    "Normal hook run when entering programming modes."
> > >    :type 'hook
> > > -  :options '(flyspell-prog-mode abbrev-mode flymake-mode linum-mode
> > > +  :options '(flyspell-prog-mode abbrev-mode flymake-mode
> > > +                                display-line-numbers-mode
> > >                                  prettify-symbols-mode)
> >
> > Hmm... is it reasonable to run prog-mode-hook just because someone
> > turns on line numbers?  It sounds too drastic to me.
> 
> I'm not sure I understand what you mean.  I thought that this just
> means that when running M-x customize-option RET prog-mode-hook RET we
> show display-line-numbers-mode instead of linum-mode as an option.

My point is that neither linum-mode nor display-line-numbers-mode are
for program sources.  But that's not a very important point, so maybe
ignore me.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#37120; Package emacs. (Thu, 22 Aug 2019 12:31:01 GMT) Full text and rfc822 format available.

Message #17 received at 37120 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefan <at> marxist.se>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 37120 <at> debbugs.gnu.org
Subject: Re: bug#37120: [PATCH] Prefer display-line-numbers over linum in docs
 and custom
Date: Thu, 22 Aug 2019 14:29:58 +0200
[Message part 1 (text/plain, inline)]
Eli Zaretskii <eliz <at> gnu.org> writes:

> I'd prefer "displays line numbers in the text area, before each line".

In the attached patch, the suggested text is changed as you suggest
and extended with details on how to use it.  WDYT?

> ("Left side" is not entirely accurate, because in R2L paragraphs the
> numbers are displayed on the right.)

Good point.

> My point is that neither linum-mode nor display-line-numbers-mode are
> for program sources.  But that's not a very important point, so maybe
> ignore me.

OK, thanks for clarifying.

Best regards,
Stefan Kangas
[0001-Prefer-display-line-numbers-over-linum-in-docs-and-o.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#37120; Package emacs. (Thu, 22 Aug 2019 13:20:02 GMT) Full text and rfc822 format available.

Message #20 received at 37120 <at> debbugs.gnu.org (full text, mbox):

From: Robert Pluim <rpluim <at> gmail.com>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 37120 <at> debbugs.gnu.org
Subject: Re: bug#37120: [PATCH] Prefer display-line-numbers over linum in docs
 and custom
Date: Thu, 22 Aug 2019 15:19:42 +0200
>>>>> On Thu, 22 Aug 2019 14:29:58 +0200, Stefan Kangas <stefan <at> marxist.se> said:

    Stefan> From 0e76a8238b684860eb75f049dffd0c7b4c978272 Mon Sep 17 00:00:00 2001
    Stefan> From: Stefan Kangas <stefankangas <at> gmail.com>
    Stefan> Date: Sat, 1 Jun 2019 01:40:11 +0200
    Stefan> Subject: [PATCH] Prefer display-line-numbers over linum in docs and one
    Stefan>  defcustom

    Stefan> * doc/misc/efaq.texi: Replace linum with display-line-numbers-mode.
    Stefan> * lisp/progmodes/prog-mode.el (prog-mode-hook): Replace linum-mode
    Stefan> with display-line-numbers-mode in :options.
    Stefan> ---
    Stefan>  doc/misc/efaq.texi          | 19 ++++++++++++++-----
    Stefan>  lisp/progmodes/prog-mode.el |  3 ++-
    Stefan>  2 files changed, 16 insertions(+), 6 deletions(-)

    Stefan> diff --git a/doc/misc/efaq.texi b/doc/misc/efaq.texi
    Stefan> index 8fd3bf3a45..67fc05c810 100644
    Stefan> --- a/doc/misc/efaq.texi
    Stefan> +++ b/doc/misc/efaq.texi
    Stefan> @@ -1687,11 +1687,20 @@ Displaying the current line or column
    Stefan>  this variable.
 
    Stefan>  @cindex Set number capability in @code{vi} emulators
    Stefan> -The @samp{linum} package (distributed with Emacs since version 23.1)
    Stefan> -displays line numbers in the left margin, like the ``set number''
    Stefan> -capability of @code{vi}.  The packages @samp{setnu} and
    Stefan> -@samp{wb-line-number} (not distributed with Emacs) also implement this
    Stefan> -feature.
    Stefan> +The @samp{display-line-numbers} package (added to Emacs in version
    Stefan> +26.1) displays line numbers in the text area, before each line, like
    Stefan> +the ``set number'' capability of @code{vi}.  Customize
    Stefan> the

@samp around 'set number'? (although it was like that before your changes).

    Stefan> +buffer-local variable 'display-line-numbers' to activate this optional
    Stefan> +display.  Alternatively, you can use the 'display-line-numbers-mode'
    Stefan> +minor mode or the global 'global-display-line-numbers-mode'.  When
    Stefan> +using these modes, customize 'display-line-numbers-type' with the same
    Stefan> +value as you would use with 'display-line-numbers'.
    Stefan> +

All these variables/command should use @code{} rather than explicit quotes, I
think.

Robert




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#37120; Package emacs. (Thu, 22 Aug 2019 13:29:01 GMT) Full text and rfc822 format available.

Message #23 received at 37120 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefan <at> marxist.se>
To: Robert Pluim <rpluim <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 37120 <at> debbugs.gnu.org
Subject: Re: bug#37120: [PATCH] Prefer display-line-numbers over linum in docs
 and custom
Date: Thu, 22 Aug 2019 15:27:53 +0200
[Message part 1 (text/plain, inline)]
Robert Pluim <rpluim <at> gmail.com> writes:

> All these variables/command should use @code{} rather than explicit quotes, I
> think.

Oops, you are correct of course.  Please find attached a patch fixing that.

Thanks,
Stefan Kangas
[0001-Prefer-display-line-numbers-over-linum-in-docs-and-o.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#37120; Package emacs. (Sat, 24 Aug 2019 06:55:02 GMT) Full text and rfc822 format available.

Message #26 received at 37120 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: rpluim <at> gmail.com, 37120 <at> debbugs.gnu.org
Subject: Re: bug#37120: [PATCH] Prefer display-line-numbers over linum in docs
 and custom
Date: Sat, 24 Aug 2019 09:54:53 +0300
> From: Stefan Kangas <stefan <at> marxist.se>
> Date: Thu, 22 Aug 2019 15:27:53 +0200
> Cc: Eli Zaretskii <eliz <at> gnu.org>, 37120 <at> debbugs.gnu.org
> 
> > All these variables/command should use @code{} rather than explicit quotes, I
> > think.
> 
> Oops, you are correct of course.  Please find attached a patch fixing that.

LGTM, thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#37120; Package emacs. (Tue, 27 Aug 2019 00:47:01 GMT) Full text and rfc822 format available.

Message #29 received at 37120 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefan <at> marxist.se>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Robert Pluim <rpluim <at> gmail.com>, 37120 <at> debbugs.gnu.org
Subject: Re: bug#37120: [PATCH] Prefer display-line-numbers over linum in docs
 and custom
Date: Tue, 27 Aug 2019 02:45:46 +0200
close 37120 27.1
quit

Eli Zaretskii <eliz <at> gnu.org> writes:

> LGTM, thanks.

Thanks; pushed to master as commit 3ef6849b45.

Best regards,
Stefan Kangas




bug marked as fixed in version 27.1, send any further explanations to 37120 <at> debbugs.gnu.org and Stefan Kangas <stefan <at> marxist.se> Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Tue, 27 Aug 2019 00:47:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 24 Sep 2019 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 209 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.