I want to enable display-line-numbers-mode in all buffers except pdf buffers. Can I do that without making a list of all the major modes except pdf-view mode?


Substitute my-pdf-mode-hook for whichever major-mode that should be excluded.

(global-display-line-numbers-mode t)

(add-hook 'my-pdf-mode-hook (lambda () (display-line-numbers-mode -1)))

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.