narf:exit-mode-maybe (jk): don't affect undo history

This commit is contained in:
Henrik Lissner 2015-12-10 16:10:51 -05:00
parent 9845101db9
commit 7c37162d9b

View file

@ -246,22 +246,23 @@ to abort the minibuffer."
(evil-define-command narf:exit-mode-maybe () (evil-define-command narf:exit-mode-maybe ()
"Exits insert/replace mode using jk without the momentary pause caused by "Exits insert/replace mode using jk without the momentary pause caused by
key-chord-define." key-chord-define."
:repeat change :repeat nil
(interactive) (interactive)
(let ((modified (buffer-modified-p))) (let ((modified (buffer-modified-p))
(call-interactively 'self-insert-command) (buffer-undo-list t))
(let ((evt (read-event nil nil 0.4))) (call-interactively 'self-insert-command)
(cond (let ((evt (read-event nil nil 0.4)))
((null evt) (message "")) (cond
((and (integerp evt) (or (char-equal evt ?k) ((null evt) (message ""))
(char-equal evt ?K))) ((and (integerp evt) (or (char-equal evt ?k)
(if (evil-replace-state-p) (char-equal evt ?K)))
(evil-replace-backspace) (if (evil-replace-state-p)
(delete-char -1)) (evil-replace-backspace)
(set-buffer-modified-p modified) (delete-char -1))
(push 'escape unread-command-events)) (set-buffer-modified-p modified)
(t (push 'escape unread-command-events))
(setq unread-command-events (append unread-command-events (list evt))))))))) (t
(setq unread-command-events (append unread-command-events (list evt)))))))))
(provide 'core-defuns) (provide 'core-defuns)
;;; core-defuns.el ends here ;;; core-defuns.el ends here