Emacs光标移动建议

时间:2013-03-16 18:21:23

标签: emacs elisp advising-functions defadvice

我编写了一个次要模式,当光标在缓冲区周围移动时,该模式突出显示缓冲区的各个部分。我通过建议这样的运动功能来做到这一点。

...
(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 个答案:

答案 0 :(得分:1)

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