基于次模式更改光标颜色 [英] Changing cursor color based on a minor mode
本文介绍了基于次模式更改光标颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果在启用导航模式时,如何增强此次要模式来更改光标的颜色,并在禁用模式时将其更改?可以使用钩子Navi-mode-hook吗?
解决方案
尝试这样:
(define-minor-mode foo-modedoodad:light
(如果foo-mode
(setq cursor-type'bar)
(setq cursor-type(default-value'cursor-type))))
或者,如果您预期 cursor-type
已经具有非默认值,则可以在启用模式时保存它,并在禁用时恢复保存的值。 p>
I have written a minor-mode, it defines some key bindings and does some initialization. The mode properly sets up Navi-mode and Navi-mode-map.
How do I enhance this minor-mode to change the color of the cursor when Navi-mode is enabled, and change it back whenever the mode is disabled? Can I use the hook Navi-mode-hook?
解决方案
Try this:
(define-minor-mode foo-mode "doodad" :lighter ""
(if foo-mode
(setq cursor-type 'bar)
(setq cursor-type (default-value 'cursor-type))))
Or, if you anticipate cursor-type
to already have a non-default value, you can save it when the mode is enabled and restore the saved value when it's disabled.
这篇关于基于次模式更改光标颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文