branch: elpa/evil-lisp-state
commit f6923427e9e09b9d7a90a6148f8cdf14ffa74f81
Author: syl20bnr <[email protected]>
Commit: syl20bnr <[email protected]>

    Add variable evil-lisp-state-default-state
    
    Allow to choose the state to activate when leaving the list state.
---
 evil-lisp-state.el | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/evil-lisp-state.el b/evil-lisp-state.el
index d3db8782e8..d9bf93c33d 100644
--- a/evil-lisp-state.el
+++ b/evil-lisp-state.el
@@ -145,6 +145,9 @@ If `evil-lisp-state-global' is non nil then this variable 
has no effect."
     :type 'sexp
     :group 'evil-lisp-state))
 
+(defvar evil-lisp-state-default-state 'normal
+  "The state to activate when exiting lisp state")
+
 (defmacro evil-lisp-state-enter-command (command)
   "Wrap COMMAND to call evil-lisp-state before executing COMMAND."
   (let ((funcname (if (string-match "lisp-state-"
@@ -180,8 +183,13 @@ If `evil-lisp-state-global' is non nil then this variable 
has no effect."
       :evil-states (normal)
       :major-modes ,evil-lisp-state-major-modes)))
 
+(defun evil-lisp-state/quit ()
+  "Quit lisp state and set state `evil-lisp-state-default-state'."
+  (interactive)
+  (funcall (intern (format "evil-%S-state" evil-lisp-state-default-state))))
+
 ;; escape
-(define-key evil-lisp-state-map [escape] 'evil-normal-state)
+(define-key evil-lisp-state-map [escape] 'evil-lisp-state/quit)
 ;; toggle lisp state
 (define-key evil-lisp-state-map "." 'lisp-state-toggle-lisp-state)
 ;; hjkl

Reply via email to