Add gist for paredit in the minibuffer
This commit is contained in:
parent
84d40cdb8a
commit
e4c92482b8
33
gists.org
33
gists.org
|
@ -329,6 +329,39 @@ Found [[https://www.reddit.com/r/emacs/comments/e2u5n9/comment/f918t22/][a Reddi
|
|||
(eshell-mode . outline-minor-mode))
|
||||
#+end_src
|
||||
|
||||
* Paredit inside minibuffer commands
|
||||
|
||||
Used [[https://github.com/purcell/emacs.d/blob/master/lisp/init-paredit.el][Purcell's configation]] as a starting point.
|
||||
|
||||
#+name: minibuffer-paredit
|
||||
#+begin_src elisp :tangle gists/minibuffer-paredit.el
|
||||
(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)))
|
||||
#+end_src
|
||||
|
||||
|
||||
* Meta
|
||||
** License
|
||||
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
(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)))
|
Loading…
Reference in New Issue