From 9219fa7c08779a3383476f06437d954a8242cd9c Mon Sep 17 00:00:00 2001 From: Tim Ruffing Date: Fri, 18 Jul 2025 09:50:02 +0200 Subject: [PATCH] fix(latex): disable smartparens pairs conflicting with AucTeX This disables smartparens pairs for quotation marks, which are broken. Before this commit, typing a LaTeX comment % "Foo" inserted % ''Foo`|`'' where | indicates the position of the cursor (wtf!). Let's better AucTeX's support for quotation marks for now and accept that the user won't get automatic insertions of closing quotation marks. This also removes a wrong comment mentioning the non-existing variable `+latex-enable-plain-double-quotes'. --- modules/lang/latex/config.el | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/modules/lang/latex/config.el b/modules/lang/latex/config.el index faa848353..0f939d336 100644 --- a/modules/lang/latex/config.el +++ b/modules/lang/latex/config.el @@ -96,11 +96,16 @@ okular and pdf-tools.") "\\bigl\\{" "\\biggl\\{" "\\Bigl\\{" "\\Biggl\\{" "\\lfloor" "\\lceil" "\\langle" "\\lVert" "\\lvert" - "`")) - (sp-local-pair modes open nil :actions :rem)) - ;; And tweak these so that users can decide whether they want use LaTeX - ;; quotes or not, via `+latex-enable-plain-double-quotes'. - (sp-local-pair modes "``" nil :unless '(:add sp-in-math-p)))) + ;; Disable pairs that interfere with AucTeX, + ;; see https://github.com/Fuco1/smartparens/pull/1151. + "`" "``" "\"")) + ;; Some of the above pairs are in smartparens' global list, which + ;; applies to all modes, so we need a local ":actions nil" override + ;; (instead of ":actions :rem", which removes from the local list). + ;; While this keeps the pairs in `sp-pairs', it has negligible + ;; performance impact because smartparens will omit the pairs when + ;; building the buffer-local `sp-local-pairs' used during operation. + (sp-local-pair modes open nil :actions nil)))) ;; Hook LSP, if enabled. (when (modulep! +lsp) (add-hook! '(tex-mode-local-vars-hook