4

I have written a minor mode that highlights various parts of the buffer as the cursor moves around the buffer. I do this by advising the movement functions like this.

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

But this seems like the wrong way to do this. I've looked for a hook for cursor movement but there doesn't appear to be one.

Am I missing a hook I can use instead of advising a bunch of movement functions, or is there a better way to approach this?

Drew
  • 29,895
  • 7
  • 74
  • 104
Sheldon
  • 43
  • 3

1 Answers1

1

Hmm... I sent you an email a few days ago suggesting to include showcss in GNU ELPA in which I also suggested you use post-command-hook instead of those defadvices.

Stefan
  • 27,908
  • 4
  • 53
  • 82