aboutsummaryrefslogtreecommitdiff
path: root/evil-states.el
diff options
context:
space:
mode:
authorjustbur <justin@burkett.cc>2016-06-05 13:55:56 -0400
committerjustbur <justin@burkett.cc>2016-06-05 13:55:56 -0400
commit18b5e6b9e43b87b721e0a6b29fb523274fd1d28b (patch)
treea251351ef7a14f5ca782b45f8286e4e5edd217dc /evil-states.el
parent630eec16a70e1741d5d9ac52be7852d9bdccfa02 (diff)
Tweak undo behavior to fix #594
In v25.1, emacs changes the way undo boundaries are automatically removed to combine commands into single undo steps. #594 is the result of more aggresive removals of undo boundaries. To fix this, make evil more active in inserting undo boundaries when entering and exiting insert and replace state by creating a boundary automatically if none exists. A slightly different issue in #594 is that the fine option of evil-want-fine-undo was not always working correctly. The reason is that it removed the first undo boundary after exiting insert state regardless of whether it made sense to do so (i.e., regardless of whether there was a change command). This commit removes the fine option and simplifies the meaning of the variable to mean aggregate commands like vim or use Emacs heuristics.
Diffstat (limited to 'evil-states.el')
-rw-r--r--evil-states.el8
1 files changed, 4 insertions, 4 deletions
diff --git a/evil-states.el b/evil-states.el
index 2e39db4..522cb16 100644
--- a/evil-states.el
+++ b/evil-states.el
@@ -83,13 +83,13 @@ If the region is activated, enter Visual state."
((evil-insert-state-p)
(add-hook 'pre-command-hook #'evil-insert-repeat-hook)
(unless (eq evil-want-fine-undo t)
- (evil-start-undo-step t)))
+ (evil-start-undo-step)))
(t
(remove-hook 'pre-command-hook #'evil-insert-repeat-hook)
(setq evil-insert-repeat-info evil-repeat-info)
(evil-set-marker ?^ nil t)
(unless (eq evil-want-fine-undo t)
- (evil-end-undo-step t (eq evil-want-fine-undo 'fine)))
+ (evil-end-undo-step))
(when evil-move-cursor-back
(when (or (evil-normal-state-p evil-next-state)
(evil-motion-state-p evil-next-state))
@@ -814,12 +814,12 @@ CORNER defaults to `upper-left'."
(overwrite-mode 1)
(add-hook 'pre-command-hook #'evil-replace-pre-command nil t)
(unless (eq evil-want-fine-undo t)
- (evil-start-undo-step t)))
+ (evil-start-undo-step)))
(t
(overwrite-mode -1)
(remove-hook 'pre-command-hook #'evil-replace-pre-command t)
(unless (eq evil-want-fine-undo t)
- (evil-end-undo-step t))
+ (evil-end-undo-step))
(when evil-move-cursor-back
(evil-move-cursor-back))))
(setq evil-replace-alist nil))