Problem with defining advice for `evil-delete'
I found very weird problem after added advice for `evil-delete'. Here is the .emacs:
(require 'evil) (evil-mode 1) (defadvice evil-delete (around around-delete activate) ad-do-it) (require 'surround) (global-surround-mode 1)
(print "Shouldn't have come here.")
to the function `evil-delete', like the following:
(evil-define-operator evil-delete (beg end type register yank-handler) "Delete text from BEG to END with TYPE. Save in REGISTER or in the kill-ring with YANK-HANDLER." (interactive "<R><x><y>") + (print "Shouldn't have come here.") (evil-yank beg end type register yank-handler) (if (eq type 'block) (evil-apply-on-block #'delete-region beg end) (delete-region beg end)) ;; place cursor on beginning of line (when (and (evil-called-interactively-p) (eq type 'line)) (evil-first-non-blank)))
Find some text surrounded by "()", say
Move the point to the 's' and type "ds(", you will notice that "ds(" is not working as expected, and you will get the message "Shouldn't have come here".
If you remove the advice to `evil-delete' and do this test again everything will work as expected and the message "Shouldn't have come here" wouldn't show up.