From 9f7ed13160b17139512e4baa9201006c1569cf3e Mon Sep 17 00:00:00 2001 From: syl20bnr Date: Mon, 21 Sep 2015 23:57:53 -0400 Subject: [PATCH] Add support for read-only buffers --- evil-escape.el | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/evil-escape.el b/evil-escape.el index ecaa499..260fcfc 100644 --- a/evil-escape.el +++ b/evil-escape.el @@ -244,13 +244,15 @@ with a key sequence." (defun evil-escape--insert () "Insert the first key of the sequence." - (pcase evil-state - (`insert (evil-escape--insert-2) t) - (`emacs (evil-escape--insert-2) t) - (`hybrid (evil-escape--insert-2) t) - (`normal - (when (window-minibuffer-p) (evil-escape--insert-func) t)) - (`iedit-insert (evil-escape--insert-func) t))) + (condition-case err + (pcase evil-state + (`insert (evil-escape--insert-2) t) + (`emacs (evil-escape--insert-2) t) + (`hybrid (evil-escape--insert-2) t) + (`normal + (when (window-minibuffer-p) (evil-escape--insert-func) t)) + (`iedit-insert (evil-escape--insert-func) t)) + ('error nil))) (defun evil-escape--insert-2 () "Insert character while taking into account mode specificites."