我编写了一个小模式,当光标在缓冲区移动时,它会突出显示缓冲区的各个部分。我通过像这样建议移动函数来实现这一点。
...
(defadvice next-line (after showcss/advise-main)
"Advice around cursor movement"
(highlight-some-stuff))
(defadvice previous-line (after showcss/advise-main)
"Advice around cursor movement"
(highlight-some-stuff))
(defadvice right-char (after showcss/advise-main)
"Advice around cursor movement"
(highlight-some-stuff))
(defadvice left-char (after showcss/advise-main)
"Advice around cursor movement"
(highlight-some-stuff))
(defadvice forward-word (after showcss/advise-main)
"Advice around cursor movement"
(highlight-some-stuff))
(defadvice backward-word (after showcss/advise-main)
"Advice around cursor movement"
(highlight-some-stuff))
...
但这似乎不是正确的方法。我已经寻找光标移动的钩子,但似乎没有找到。
我是否错过了可以使用的钩子,而不是建议一堆移动函数,或者有更好的方法来解决这个问题?