Home
Head's Up: I'm in the middle of upgrading my site. Most things are in place, but there are something missing and/or broken including image alt text. Please bear with me while I'm getting things fixed.

Turn On Line Numbers For Python Automatically In Emacs

I added this to my [TODO: Code shorthand span ] file to turn on relative line numbers when in Python mode :

lisp
(add-hook 'python-mode-hook 
  (lambda () 
    (display-line-numbers-mode +1)
    (setq display-line-numbers 'relative)
    ))

I had to move this outside of the user [TODO: Code shorthand span ] config section. It doesn't work if you put it in there.

This example uses python. It works with other modes as well. I confirmed the name of the hook finding the name of the variable via [TODO: Code shorthand span ] then typing [TODO: Code shorthand span ] and scanning the results to find what I'm looking for.