diff options
| author | Frank Fischer <frank-fischer@shadow-soft.de> | 2014-04-11 09:38:20 +0200 |
|---|---|---|
| committer | Frank Fischer <frank-fischer@shadow-soft.de> | 2014-04-11 09:38:20 +0200 |
| commit | d7a3ac17f9df30377edc5e8909b2ac289ad7d58e (patch) | |
| tree | 9d4b060f8d4028f2deb946f8fc23f62e79513155 | |
| parent | 58a90973d07b8c22e5f87c37a0e9bae79d7ae425 (diff) | |
ensure `evil-with-undo` ends with exactly one boundary (fix #382)
After using this macro `buffer-undo-list` or `evil-temporary-undo`
should contain the undo information with exactly one boundary at the
beginning (so that subsequent modifications do not merge with those
executed within the body of `evil-with-undo`).
In the old code the resulting `buffer-undo-list` might contain two
boundaries (which is forbidden) if the modifications run within the
body added a boundary to the beginning of `buffer-undo-list`
themselves. In particular, this happens when repeating a previous
modification using the dot-command, because `evil-end-undo-step` adds
such a boundary.
| -rw-r--r-- | evil-common.el | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/evil-common.el b/evil-common.el index 2536afe..a9d24b6 100644 --- a/evil-common.el +++ b/evil-common.el @@ -2875,7 +2875,11 @@ is stored in `evil-temporary-undo' instead of `buffer-undo-list'." (let (buffer-undo-list) (prog1 (progn ,@body) - (setq evil-temporary-undo (cons nil buffer-undo-list)))) + (setq evil-temporary-undo buffer-undo-list) + ;; ensure evil-temporary-undo starts with exactly one undo + ;; boundary marker, i.e. nil + (unless (null (car-safe evil-temporary-undo)) + (push nil evil-temporary-undo)))) (unless (eq buffer-undo-list t) ;; undo is enabled, so update the global buffer undo list (setq buffer-undo-list |
