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'.
This commit is contained in:
Tim Ruffing
2025-07-18 09:50:02 +02:00
committed by Henrik Lissner
parent ac530efe87
commit 9219fa7c08

View File

@@ -96,11 +96,16 @@ okular and pdf-tools.")
"\\bigl\\{" "\\biggl\\{" "\\Bigl\\{" "\\Biggl\\{" "\\bigl\\{" "\\biggl\\{" "\\Bigl\\{" "\\Biggl\\{"
"\\lfloor" "\\lceil" "\\langle" "\\lfloor" "\\lceil" "\\langle"
"\\lVert" "\\lvert" "\\lVert" "\\lvert"
"`")) ;; Disable pairs that interfere with AucTeX,
(sp-local-pair modes open nil :actions :rem)) ;; see https://github.com/Fuco1/smartparens/pull/1151.
;; And tweak these so that users can decide whether they want use LaTeX "`" "``" "\""))
;; quotes or not, via `+latex-enable-plain-double-quotes'. ;; Some of the above pairs are in smartparens' global list, which
(sp-local-pair modes "``" nil :unless '(:add sp-in-math-p)))) ;; 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. ;; Hook LSP, if enabled.
(when (modulep! +lsp) (when (modulep! +lsp)
(add-hook! '(tex-mode-local-vars-hook (add-hook! '(tex-mode-local-vars-hook