Fuco1 / smartparens

Minor mode for Emacs that deals with parens pairs and tries to be smart about it.
GNU General Public License v3.0
1.8k stars 193 forks source link

Problem with some triggers in LaTeX mode #771

Open sdban opened 7 years ago

sdban commented 7 years ago

I am using smartparens with AUCTeX in emacs. I was going through the smartparens-latex.el file and trying out some of the code in there. Let me consider code in lines 143- 150.

Expected behavior

So in LaTeX math mode if I press \l( or \l[ I should see \left (* \right ) and \left [ * \right ] where * is the point.

Actual behavior

Instead I get \left ((*) \right ) and \left [[* \right ].

Steps to reproduce the problem

Press \l( or \l[ inside LaTeX math mode with AUCTeX activated.

Environment & version information

TobiasZawada commented 7 years ago

Maybe the problem with double-quotes described at the end of https://emacs.stackexchange.com/a/34060/2370 is related?

For reference I cite here the relevant section:

As of 2017-07-09 (melpa-version 20170708.1326), https://github.com/Fuco1/smartparens/ seems to be broken.

If I press " in the middle between Testing and quotes of the following LaTeX text

\documentclass{article}
\usepackage[ngerman]{babel}
\begin{document}
Testing  quotes
\end{document}

I get the following strange auto-insertion:

\documentclass{article}
\usepackage[ngerman]{babel}
\begin{document}
Testing'' ` quotes
\end{document}

One can follow the execution of sp-insert-pair. The trigger character " is deleted. The open part of the pair is decomposed into its prefix " and its last character `. The last character is inserted. Then it skips backward one thing. Thereby, the thing is whatever sp-get-thing returns (here it is just space). There it inserts the closing part ''.

Fuco1 commented 7 years ago

@TobiasZawada What you describe is a different problem I think. I don't guard the case where the trigger is also a pair prefix :/ We should probably open a different issue for that.

TobiasZawada commented 7 years ago

@Fuco1 Done: #772

rommeswi commented 4 years ago

This problem still persists as of 2019 It also exists when typing the full \left( command, then it creates \left(()\right).