In my init file I have this:

(add-hook 'prog-mode-hook (lambda () (linum-mode 1)))

So it shows line numbers only for programming modes. I tried to do the same with hl-line-mode, but it does not work:

(add-hook 'prog-mode-hook (lambda () (hl-line-mode 1)))

Why is that? Both are buffer-local minor modes, according to the documentation.

Thank you.

  • 1
    It does work for me. Have you tried with emacs -Q?
    – JeanPierre
    Commented Nov 20, 2016 at 14:50

1 Answer 1


There was an unrelated problem where a symbolic link was not set so the changes I made to the init file were not being loaded. Now it works.

  • Please accept your own answer so we can close this question.
    – Dan
    Commented Dec 20, 2016 at 20:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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