I have the following in my init.el,

(setq-default display-line-numbers 'visual)
(global-display-line-numbers-mode 1)

which should give me relative line numbering. On starting emacs, it does on the startup page, but as soon as I switch to another file, the display-line-numbers variable is overriden to t, which removes relative line numbering. I am confused, as I thought that setting setq-default would ensure that new buffers would default to visual. Or is there something else going on that I am missing?


When I do C-h f display-line-numbers-mode I see this as part of the doc:

To change the type of line numbers displayed by default, customize display-line-numbers-type. To change the type while the mode is on, set display-line-numbers directly.

Have you tried doing that? Dunno whether that will help. If it does, then maybe the doc string of global-display-line-numbers-mode should also say something about this.

(I filed doc bug #48511 for this.)

  • 1
    i should really read the docs...... kept thinking it was something overriding the variable (but yes it worked!)
    – shem
    May 18 at 19:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.