How to advice `evil-delete'

York Zhao gtdplatform at gmail.com
Mon Oct 3 18:53:04 CEST 2011


> I do not know if this is indeed the solution, but `evil-yank' is in the
> end a usual Emacs command, i.e., it has an interactive-form. Your
> redefinition does not have an interactive form and is therefore not
> regarded as a command. Changing your code to
>
> ...
>  (flet ((evil-yank (&rest args) (interactive) t)) ...
>
> may work. But I haven't tested it.

Thank you very much for the help. Adding "(interactive)" didn't work, and even
worse, previously I could re-evaluate the `evil-yank' (C-M-x) to make yank work
again but after adding "(interactive)", "C-M-x" no longer do the trick and I
have to restart Emacs to make "yank" work again, provided that I don't delete
blank lines.

> Furthermore it may be easier to just call `delete-region' to remove
> those lines instead of redefining `evil-yank'. In fact, this is what
> `evil-delete' does.

Yes, that would be easier and I may have to go that way finally if I can't make
this work. However, in general, I think it is still better not to bypass the the
original function altogether ('evil-delete' here) so that I will still be able
to take advantage of new changes in the original function without having to
monitor possible changes in the original function and port them into my code in
the future. But yes, in this particular situation the `evil-delete' may not be
changed anymore and your suggestion might be better. However, if possible I
would still like to figure out why this doess't work so that I could learn
something from it.



More information about the implementations-list mailing list