feat(emacs): Support Nix's ''big quotes''

This commit is contained in:
Madeleine Sydney
2025-03-04 03:10:59 -07:00
parent 04a23ded90
commit a8943c5d67
2 changed files with 22 additions and 16 deletions

View File

@@ -25,29 +25,26 @@
;; it buffer-locally. It's less work for smartparens.
(sp-max-pair-length 4))
:config
;; load default config
;; Load default config.
(require 'smartparens-config)
;; Silence some harmless but annoying echo-area spam
(dolist (key '(:unmatched-expression :no-matching-tag))
(setf (alist-get key sp-message-alist) nil))
(defun syd-init-smartparens-in-eval-expression-h ()
"Enable `smartparens-mode' in the minibuffer for `eval-expression'. This
(syd-add-hook 'eval-expression-minibuffer-setup-hook
(defun syd-init-smartparens-in-eval-expression-h ()
"Enable `smartparens-mode' in the minibuffer for `eval-expression'. This
includes everything that calls `read--expression', e.g. `edebug-eval-expression'
Only enable it if `smartparens-global-mode' is on."
(when smartparens-global-mode
(smartparens-mode 1)))
It is only enabled it if `smartparens-global-mode' is on."
(when smartparens-global-mode
(smartparens-mode 1))))
(add-hook 'eval-expression-minibuffer-setup-hook
#'syd-init-smartparens-in-eval-expression-h)
(defun syd-init-smartparens-in-minibuffer-maybe-h ()
"Enable `smartparens' for non-`eval-expression' commands. Only enable
(syd-add-hook 'minibuffer-setup-hook
(defun syd-init-smartparens-in-minibuffer-maybe-h ()
"Enable `smartparens' for non-`eval-expression' commands. Only enable
`smartparens-mode' if `smartparens-global-mode' is on."
(when (and smartparens-global-mode (memq this-command '(evil-ex)))
(smartparens-mode 1)))
(add-hook 'minibuffer-setup-hook #'syd-init-smartparens-in-minibuffer-maybe-h)
(when (and smartparens-global-mode (memq this-command '(evil-ex)))
(smartparens-mode 1))))
;; You're likely writing lisp in the minibuffer, therefore, disable these
;; quote pairs, which lisps doesn't use for strings: