emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/evil-lisp-state f6923427e9 121/125: Add variable evil-lisp


From: ELPA Syncer
Subject: [nongnu] elpa/evil-lisp-state f6923427e9 121/125: Add variable evil-lisp-state-default-state
Date: Thu, 6 Jan 2022 04:58:46 -0500 (EST)

branch: elpa/evil-lisp-state
commit f6923427e9e09b9d7a90a6148f8cdf14ffa74f81
Author: syl20bnr <sylvain.benner@gmail.com>
Commit: syl20bnr <sylvain.benner@gmail.com>

    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

[Prev in Thread] Current Thread [Next in Thread]