Enable smartparens-mode in eval-expression

This commit is contained in:
Gerard Vermeulen 2022-04-17 19:36:57 +02:00
parent b3f5952e66
commit c063df796c

View File

@ -3112,25 +3112,20 @@ contrary to for instance [[https://github.com/Fanael/rainbow-delimiters#readme][
'(sp-override-key-bindings '(("C-(" . sp-backward-barf-sexp) '(sp-override-key-bindings '(("C-(" . sp-backward-barf-sexp)
("C-)" . sp-forward-slurp-sexp)))) ("C-)" . sp-forward-slurp-sexp))))
(dolist (hook '(prog-mode-hook text-mode-hook))
(add-hook hook #'smartparens-mode))
;; Hook on the specific `eval-expression-minibuffer-setup-hook' ;; Hook on the specific `eval-expression-minibuffer-setup-hook'
;; and not on the general `minibuffer-setup-hook'. ;; and not on the general `minibuffer-setup-hook'.
(dolist (hook '(eval-expression-minibuffer-setup-hook
prog-mode-hook
text-mode-hook))
(add-hook hook #'smartparens-mode))
(dolist (hook '(emacs-lisp-mode-hook (dolist (hook '(emacs-lisp-mode-hook
eval-expression-minibuffer-setup-hook
ielm-mode-hook ielm-mode-hook
lisp-mode-hook lisp-mode-hook
python-mode-hook python-mode-hook
sly-mrepl-mode-hook)) sly-mrepl-mode-hook))
(add-hook hook #'smartparens-strict-mode)) (add-hook hook #'smartparens-strict-mode))
;; Tweak for the call to `smartparens-strict-mode' hooked on
;; `eval-expression-minibuffer-setup-hook'.
(sp-with-modes '(fundamental-mode ; first usage.
minibuffer-inactive-mode) ; later usage.
(sp-local-pair "'" nil :actions nil))
;; https://xenodium.com/emacs-smartparens-auto-indent/index.html ;; https://xenodium.com/emacs-smartparens-auto-indent/index.html
(defun indent-between-pair (&rest _ignored) (defun indent-between-pair (&rest _ignored)
(newline) (newline)