juanjux / evil-search-highlight-persist

Emacs minor mode to highlight search results in all the buffeer until you clear them or make another, like Vim hlsearch option.
GNU General Public License v2.0
21 stars 11 forks source link

How bind the remove function to another function? #15

Closed ReneFroger closed 8 years ago

ReneFroger commented 8 years ago

Thanks for sharing this package! I never could remember the C-x combination to quitthe search highlightings.

After reading about advising functions, I decided to bound it to the default C-g.

So I did the following:

 (advice-add 'keyboard-quit :after #'evil-search-highlight-persist-remove-all)

However, I never could it get working. Perhaps could you tell me where I went wrong in this? It would be appreicated by the way.

ReneFroger commented 8 years ago

Any update on this?

ReneFroger commented 8 years ago

It seems not?

juanjux commented 8 years ago

Sorry for the delay, my bogofilter was marking these as spam except the last message for some reason. The thing is that I'm not currently using Emacs, I went back to Vim so I only start emacs to test merge requests, basically. So with this and my lack of knowledge of emacs I can't help you.

ReneFroger commented 8 years ago

Thanks juanjux for your reply, it's appreciated!

ReneFroger commented 8 years ago

For future readers:

(defun quit-and-exit-persistent-hl ()
    (interactive)
    (evil-search-highlight-persist-remove-all)
    (keyboard-quit)
    )

And then

(global-set-key (kbd "C-g") 'quit-and-exit-persistent-hl)