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。