Skip to content

Commit

Permalink
Fix: perf improvements broke macro repeatability. Restore it.
Browse files Browse the repository at this point in the history
  • Loading branch information
tomdl89 committed Jul 21, 2024
1 parent ca7c557 commit 404875a
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion evil-commands.el
Original file line number Diff line number Diff line change
Expand Up @@ -2510,6 +2510,14 @@ will be opened instead."
(setq evil-macro-buffer (current-buffer)))
(t (error "Invalid register `%s'" register)))))

(defun evil-repeat-execute-macro (flag)
"Called to record a macro execution.
FLAG is either `pre' or `post' if the function is called before resp.
after executing the command."
(pcase flag
('pre (evil-repeat-record (this-command-keys)))
('post (evil-repeat-record (string evil-last-register)))))

(evil-define-command evil-execute-macro (count macro)
"Execute keyboard macro MACRO, COUNT times.
When called with a non-numerical prefix \
Expand All @@ -2518,6 +2526,7 @@ COUNT is infinite. MACRO is read from a register
when called interactively."
:keep-visual t
:suppress-operator t
:repeat evil-repeat-execute-macro
(interactive
(let (count macro register)
(setq count (cond ((null current-prefix-arg) 1)
Expand Down Expand Up @@ -2554,7 +2563,8 @@ when called interactively."
(evil-with-single-undo
(let (pre-command-hook post-command-hook) ; For performance
(combine-after-change-calls
(execute-kbd-macro macro count))))
(execute-kbd-macro macro count)
(setq this-command 'evil-execute-macro)))) ; For repeatability
;; enter Normal state if the macro fails
(error
(evil-normal-state)
Expand Down

0 comments on commit 404875a

Please sign in to comment.