0

I have set multiple modes to not show display-line-number-mode and recently I added compilation-mode to that list, but the compilation-mode still shows line numbers. Here is the relevant code,

  ;; Disable line numbers for some modes
  (dolist (mode '(org-mode-hook
                  term-mode-hook
                  shell-mode-hook
                  treemacs-mode-hook
                  eshell-mode-hook
                  vterm-mode-hook
                  compilation-mode        ;; <----
                  telega-root-mode-hook
                  telega-chat-mode-hook
                  erc-mode-hook))
    (add-hook mode (lambda () (display-line-numbers-mode 0))))

What am I doing wrong here?

3
  • 2
    Don't you have a typo? Shouldn't it be compilation-mode-hook? Jun 15, 2022 at 17:22
  • try (display-line-numbers-mode -1)
    – TerryTsao
    Jun 16, 2022 at 3:14
  • @SwarnenduBiswas Yes, it was a silly mistake, I missed -hook. Thanks!
    – apoorv569
    Jun 16, 2022 at 5:35

1 Answer 1

0

It was compilation-mode-hook instead of compilation-mode.

1
  • As an aside, I think if you'd named your variable hook (for what it was) instead of mode (which it wasn't), you might well have spotted that yourself.
    – phils
    Jul 16, 2022 at 8:46

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.