aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoão Távora <joaotavora@gmail.com>2018-04-13 11:50:19 +0100
committerJoão Távora <joaotavora@gmail.com>2018-04-13 11:51:23 +0100
commit07647e50deffc367f06abb44f77e3ba917f74059 (patch)
tree949a434a5438336e6f7fe51494d8d11c93afce30
parent49ebf2dce325bc7fe0941dc4112226c291ff9670 (diff)
Better protect against modes that disable undo
Even though 'evil-start-undo-step' does check buffer-undo-list, it is possible that the forms wrapped by 'evil-with-undo' disable undo in the meantime. In those conditions, 'evil-refresh-undo-step' will eventually error. https://github.com/joaotavora/sly/issues/156 references such an incident. * evil-common.el (evil-end-undo-step): Also check that buffer-undo-list is a list here.
-rw-r--r--evil-common.el3
1 files changed, 2 insertions, 1 deletions
diff --git a/evil-common.el b/evil-common.el
index 381fee0..62eda5f 100644
--- a/evil-common.el
+++ b/evil-common.el
@@ -3435,7 +3435,8 @@ are included. The step is terminated with `evil-end-undo-step'."
(defun evil-end-undo-step (&optional continue)
"End a undo step started with `evil-start-undo-step'.
Adds an undo boundary unless CONTINUE is specified."
- (when (and evil-undo-list-pointer
+ (when (and (listp buffer-undo-list)
+ evil-undo-list-pointer
(not evil-in-single-undo))
(evil-refresh-undo-step)
(unless (or continue (null (car-safe buffer-undo-list)))