aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank Fischer <frank.fischer@mathematik.tu-chemnitz.de>2012-11-02 20:35:17 +0100
committerFrank Fischer <frank.fischer@mathematik.tu-chemnitz.de>2012-11-02 20:35:17 +0100
commit193c57929b8cb17561512b3e65cce058f8ee6e4b (patch)
tree4e9a0b9659d076c0c883b7e964157ed031fb4a8e
parent0c3c4d2a18b90ff9a140ad98d6882f542d93c53b (diff)
Ensure emacs-state-buffer is alive when finishing emacs-state command
The command executed in emacs-state may have deleted the buffer. In this case the attempt to select that buffer in `evil-execute-in-emacs-state' will raise an error. We now ensure that the buffer is still alive. This fixes #176.
-rw-r--r--evil-commands.el5
1 files changed, 3 insertions, 2 deletions
diff --git a/evil-commands.el b/evil-commands.el
index 8a736fb..2b4efe4 100644
--- a/evil-commands.el
+++ b/evil-commands.el
@@ -3413,8 +3413,9 @@ if the previous state was Emacs state."
(evil-echo "Switched to Emacs state for the next command ..."))
((not (eq this-command #'evil-execute-in-emacs-state))
(remove-hook 'post-command-hook 'evil-execute-in-emacs-state)
- (with-current-buffer evil-execute-in-emacs-state-buffer
- (evil-change-to-previous-state))
+ (when (buffer-live-p evil-execute-in-emacs-state-buffer)
+ (with-current-buffer evil-execute-in-emacs-state-buffer
+ (evil-change-to-previous-state)))
(setq evil-execute-in-emacs-state-buffer))))
;; TODO: this will probably not work well with the repeat-system.