Open vitaminace33 opened 3 years ago
The above mentioned workaround improves the behavior for German quotes (by a lot) but does not resolve the issues completely.
When pressing "
, it inserts "`▂'
(with ▂ being the cursor) instead of "`▂"'
. When finishing the quote and pressing "
again, it correctly inserts "'
at the end, but leaves the additional '
from before, i.e., typing "foo"
gives me "`foo"'▂'
instead of "`foo"'▂
.
For better reproducibility, here is my tex-code:
\documentclass{article}
\usepackage{ngerman}
\begin{document}
"`foo"'
\end{document}
And here the value I have set TeX-quote-language-alist
to:
'(("ngerman" "\"`" "\"'" nil) ("german" "\"`" "\"'" nil))
Hi, I just want to state that this is still an issue.
Since TeX-insert-quote
provides its own behaviours, the easiest would be to disable smartparens handling of quotes if you prefer the auctex way.
(sp-local-pair 'latex-mode "`" nil :actions nil)
(sp-local-pair 'latex-mode "\"" nil :actions nil)
(sp-local-pair 'latex-mode "``" nil :actions nil)
I'm sure it could be made to work together, for example by dynamically adding pairs based on TeX-quote-language
, then if you insert the opening smartparens would insert the ending. But I guess this is also somehow implemented in auctex itself.
To be completely honest, I don't really use tex anymore so this is not very high priority for me. Plus I don't understand how auctex handles this and what users expect, so it's really hard to create a good solution. We can brainstorm some ideas and if there is consensus something can be implemented. But a safe way would be to defer the quote handling to auctex.
Hi!
Thanks for your reply. I have played around a bit, and I sincerely do not understand what is going on.
Using
(sp-local-pair '(tex-mode plain-tex-mode latex-mode LaTeX-mode) "``" nil :actions nil)
I can normally write a single double quote "
in the comments, but NOT in the
rest of the document. For example, typing "
would insert a triple of ```
I can not see how smartparens distinguishes comments from non-comments. It could
be that AucTeX mode is doing some magic behind the scenes, but well.
Then, further deactivating
(sp-local-tag '(tex-mode plain-tex-mode latex-mode LaTeX-mode) "\"" nil nil :actions nil)
doesn't really change things (which is a further indication that we are observing a weird interaction with AucTeX).
Finally, deactivating
(sp-local-pair '(tex-mode plain-tex-mode latex-mode LaTeX-mode) "`" nil :actions nil)
leads to classic AucTeX behavior: In LaTeX comments, insertion is unchanged. In
the document (non-comments), a single ` or ' are inserted without further
changes. A double quote "
is changed to a double `` quote at the beginning of
a word, and a double '' (two '
quotes) at the end of a word, as expected (only the insertion
has to be manual, and not automatic like with smartparens
)
So in the end, I think it is probably best to deactivate all three quotes in smartparens-mode
, as you suggested (but use all four modes like in this comment). I can create a PR, if you like.
Finally, I do not understand what this statement does in smartparens-latex.el
:
(sp-local-tag "\"" "``" "''" :actions '(wrap))
Should we also remove it?
Yea, tags no longer exist
Expected behavior
Press
["]
once to get«.»
, twice for"."
(or vice-versa ifTeX-quote-after-quote
is non-nil).Notes
TeX-quote-open
andTeX-quote-close
but could be different depending on the applied language style, e.g."<
and">
, respectively.Actual behavior
Press
["]
once, depending on the value ofTeX-quote-after-quote
and ifTeX-quote-open
andTeX-quote-close
are single or double characters, different behavior are present. Worst case scenario is that only part of the quote string is inserted, moreover partly in the previous line and partly in the current, while deleting a previous character. Refer to syl20bnr/spacemacs#15003 for specific "experiments".Steps to reproduce the problem
auctex
andsmartparens
.\usepackage[german]{babel}
(parsing on load must be activated to successfully load the language style).I leave here my
.emacs
for reference.Workaround
A workaround has been documented in syl20bnr/spacemacs#15003 that allows the use
smartparens
.Environment & version information
smartparens
version: 20210817.1912major-mode
:latex-mode
M-x emacs-version
): GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, cairo version 1.16.0) of 2020-09-19