25 lines
1.1 KiB
EmacsLisp
25 lines
1.1 KiB
EmacsLisp
(use-package paredit
|
|
:hook
|
|
(minibuffer-setup . my/conditionally-enable-paredit-mode)
|
|
(minibuffer-exit . my/restore-paredit-key)
|
|
:config
|
|
(defvar my/paredit-minibuffer-commands '(eval-expression
|
|
pp-eval-expression
|
|
eval-expression-with-eldoc
|
|
ibuffer-do-eval
|
|
ibuffer-do-view-and-eval
|
|
org-ql-sparse-tree
|
|
org-ql-search)
|
|
"Interactive commands for which paredit should be enabled in the minibuffer.")
|
|
|
|
(defun my/conditionally-enable-paredit-mode ()
|
|
"Enable paredit during lisp-related minibuffer commands."
|
|
(when (memq this-command my/paredit-minibuffer-commands)
|
|
(enable-paredit-mode)
|
|
(unbind-key (kbd "RET") paredit-mode-map)))
|
|
|
|
(defun my/restore-paredit-key ()
|
|
"Restore the RET binding that was disabled by
|
|
my/conditionally-enable-paredit-mode."
|
|
(bind-key (kbd "RET") #'paredit-newline paredit-mode-map)))
|