fix(electric): reorder electric-quote hook to run before smartparens

When `electric-quote-mode' is enabled with smartparens, the
`electric-quote-inhibit-functions' check (e.g. `org-in-src-block-p')
fails because smartparens' post-self-insert handler runs first and
interferes with buffer state. Re-add the electric-quote handler at
depth -50 so it runs before smartparens (depth 0).

Fix: #5051

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
kovan 2026-02-13 22:39:42 +01:00 committed by Henrik Lissner
parent 76277e246f
commit 2ebac3ccfc

View file

@ -15,4 +15,13 @@ current line.")
(when (and (eolp) +electric-indent-words)
(save-excursion
(backward-word)
(looking-at-p (concat "\\<" (regexp-opt +electric-indent-words))))))))
(looking-at-p (concat "\\<" (regexp-opt +electric-indent-words)))))))
;; Fix #5051: Ensure electric-quote's handler runs before smartparens' on
;; `post-self-insert-hook', so that `electric-quote-inhibit-functions'
;; (e.g. `org-in-src-block-p') is respected in org src blocks.
(add-hook! 'electric-quote-mode-hook
(defun +electric-quote-reorder-post-self-insert-h ()
(when electric-quote-mode
(remove-hook 'post-self-insert-hook #'electric-quote-post-self-insert-function)
(add-hook 'post-self-insert-hook #'electric-quote-post-self-insert-function -50)))))