emacsemacs-speedbar

Disabling 'linum-mode' for speedbar when global 'linum-mode' is active


I have linum-mode enabled globally in my Emacs configuration. Being enabled globally means it is also applied to the speedbar which is undesirable.

The only suggestion I found for this issue, was in the archived Emacs help mailing list, which suggests the following speedbar-mode-hook:

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

Unfortunately adding this to my configuration doesn't have the desired effect and the speedbar still has line numbers.

Edit: the above add-hook seems to work correctly after all, at least for Emacs >= 24.3. Leaving question for reference purposes since there isn't any other relating to this matter on StackOverflow.


Solution

  • You can use speedbar-before-popup-hook hook for achieving what you want:

    (add-hook 'speedbar-before-popup-hook (lambda () (linum-mode -1)))
    

    I am not sure why the generic mode hook is not working, though.