2

It seems that Emacs 29.1 has deprecated linum-mode. I haven't found a replacement yet. On ELPA I see nlinum-mode, but that seems to use linum, too. So what is the official replacement?

A Schmitz
  • 23
  • 2
  • If you take a look at `linum.el`, you will see "*Consider using **native line numbers** instead: `M-x display-line-numbers-mode`*" – shynur Aug 07 '23 at 08:47

1 Answers1

6

Simply C-hn in Emacs 29 and C-s for linum to easily find this news:

** The linum.el library is now obsolete.
We recommend using either the built-in 'display-line-numbers-mode', or
the 'nlinum' package from GNU ELPA instead.  The former has better
performance, but the latter is closer to a drop-in replacement.

1. To use 'display-line-numbers-mode', add something like this to your
   init file:

    (global-display-line-numbers-mode 1)
    ;; Alternatively, to use it only in programming modes:
    (add-hook 'prog-mode-hook #'display-line-numbers-mode)

2. To use 'nlinum', add this to your Init file:

    (package-install 'nlinum)
    (global-nlinum-mode 1)
    ;; Alternatively, to use it only in programming modes:
    (add-hook 'prog-mode-hook #'nlinum-mode)

3. To continue using the obsolete package 'linum', add this line to
   your Init file, in addition to any existing customizations:

    (require 'linum)

The fast/efficient display-line-numbers-mode has been included since Emacs 26.1.

phils
  • 48,657
  • 3
  • 76
  • 115
  • (perhaps) off-topic: "*using either the built-in `display-line-numbers-mode`, or the `nlinum` package from GNU ELPA*" -- so we can display both absolute and relative line numbers at the same time by *using both packages*. – shynur Aug 07 '23 at 09:04
  • 1
    Thank you especially for the hint to look at the news. I forgot that that's a thing! – A Schmitz Aug 07 '23 at 09:23
  • This is great, thanks so much for the detailed submission – cstls Aug 09 '23 at 15:58