How to advice `evil-delete'
York Zhao
gtdplatform at gmail.com
Mon Oct 3 05:16:06 CEST 2011
Hi,
I've been straggling with this for the entire afternoon and am really really
frustrated. What I want is that when deleting an empty line, I don't want it to
be yanked, just delete.
So I adviced `evil-delete' like this and it worked as I expected.
(defadvice evil-delete
(around around-delete (beg end type register yank-handler) activate)
(if (eq type 'line)
(let (here)
(save-excursion
(goto-char beg)
(skip-chars-forward " \n\t" end)
(setq here (point)))
(if (eq here end)
(flet ((evil-yank (&rest args) t))
ad-do-it)
ad-do-it))
ad-do-it))
However, as soon as I add another advice on `evil-yank', things stopped working
correctly, even thougt the yank advice is empty like the following, things still
not working properly.
(defadvice evil-yank
(around around-yank (beg end type register yank-handler) activate)
ad-do-it)
The problem is that after I deleted an empty line, I could no longer yank
anything, whenever I yank I get the errer:
Debugger entered--Lisp error:
(wrong-type-argument commandp evil-yank)
call-interactively(evil-yank nil nil)
Could anybody give me some idea of where the problem is? Am I supposed to advice
these "special" operator functions and is there anything "special" in advicing
them?
Thanks in advace,
York
More information about the implementations-list
mailing list