2013-03-16 78 views
4

我写了一个小模式,在光标在缓冲区中移动时突出显示缓冲区的各个部分。我通过建议这样的运动功能来做到这一点。Emacs光标移动建议

... 
(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)) 
... 

但是,这似乎是错误的方式来做到这一点。我寻找光标移动的钩子,但似乎没有一个。

我错过了一个钩子我可以使用,而不是建议一堆运动功能,还是有更好的方法来解决这个问题?

回答

1

嗯......我几天前给你发了一封电子邮件,建议在GNU ELPA中包含showcss,其中我还建议你使用post-command-hook而不是那些defadvices。