简体   繁体   中英

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM