简体   繁体   English

全局“ linum-mode”处于活动状态时,禁用速度栏的“ linum-mode”

[英]Disabling 'linum-mode' for speedbar when global 'linum-mode' is active

I have linum-mode enabled globally in my Emacs configuration. 我在Emacs配置中全局启用了linum-mode 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 : 我发现的唯一建议是在存档的Emacs帮助邮件列表中,该列表建议以下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. 编辑:毕竟,至少对于Emacs> = 24.3,上述add-hook似乎可以正常工作。 Leaving question for reference purposes since there isn't any other relating to this matter on StackOverflow. 有待参考,因为StackOverflow上没有与此相关的任何其他问题。

You can use speedbar-before-popup-hook hook for achieving what you want: 您可以使用speedbar-before-popup-hook挂钩来实现所需的功能:

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

I am not sure why the generic mode hook is not working, though. 我不确定为什么通用模式钩子不起作用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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