diff --git a/evil-lisp-state.el b/evil-lisp-state.el index 5c4b85a..d061f88 100644 --- a/evil-lisp-state.el +++ b/evil-lisp-state.el @@ -114,14 +114,25 @@ (require 'smartparens) (require 'bind-map) +(defun evil-lisp-restore-smartparens-state() + (when (and (boundp 'evil-lisp-state-smartparens-keep) + (not evil-lisp-state-smartparens-keep)) + (smartparens-mode -1))) + +(add-hook 'evil-lisp-state-exit-hook + #'evil-lisp-restore-smartparens-state) + (evil-define-state lisp "Lisp state. Used to navigate lisp code and manipulate the sexp tree." :tag " " :suppress-keymap t :cursor (bar . 2) - ;; force smartparens mode - (if (evil-lisp-state-p) (smartparens-mode))) + (when (evil-lisp-state-p) + (setq-local evil-lisp-state-smartparens-keep + (symbol-value 'smartparens-mode)) + ;; force smartparens mode + (smartparens-mode))) (defgroup evil-lisp-state nil "Evil lisp state."