Repository metrics
- Stars
- (59 stars)
- PR merge metrics
- (PR metrics pending)
Description
It doesn't work to cycle the kill-ring with M-y after pasting.
Reproduction steps
- type or copy and paste the following into a new buffer:
a
a
a
b
c
d
- copy
yythe three lines: b, c and d - move the cursor to one of the first three lines (on an:
a) - call:
M-x evil-iedit-state/iedit-mode - paste:
p(evil-iedit-state/paste-replace) the threeas were replaced byds and a newline as expected:
d
d
d
b
c
d
- cycle to the previous kill-ring item by pressing:
M-y(evil-paste-pop)
Error message:
user-error: Previous command was not an evil-paste: evil-iedit-state/paste-replace
Cause
evil-paste-pop expects the following commands:
(defun evil-paste-pop (count)
"Replace the just-yanked stretch of killed text with a different stretch.
This command is allowed only immediatly after a `yank',
`evil-paste-before', `evil-paste-after' or `evil-paste-pop'.
A possible fix
Change the this-command to evil-paste-before:
(defun evil-iedit-state/paste-replace (count)
"Replace the selection with the yanked text."
(interactive "P")
(setq this-command 'evil-paste-before)
(when kill-ring (iedit-delete-occurrences))
(evil-paste-before count nil '(#'insert-as-yank)))
Now the following error is shown after pressing M-y in the reproduction steps above:
Error in post-command-hook (iedit-update-occurrences-2): (wrong-type-argument number-or-marker-p nil)
and the buffer looks like this:
c
d
b
c
d
iedit without evil or evil-iedit-state
M-y (yank-pop) works after C-y (yank) in iedit without evil or evil-iedit-state.
System Info
evil-iedit-state ;; Version: 1.2 (evil-iedit-state-20200820.1258) iedit ;; Version: 0.9.9.9 (iedit-20200807.853) Evil version 1.14.0 GNU Emacs 27.1 (build 1, x86_64-w64-mingw32) of 2020-08-12 Windows 1903