I've grown fond of electric-quote-mode in Emacs as a convenient way to get curved quotes in my documents. However, I can't seem to get it to work with either AUCTeX or BibTeX mode.
I'm aware AUCTeX has it's own support for quote insertion, which is quite advanced, interacting with babel and so on. But I'm a csquotes user and have in my preamble:
\usepackage[autostyle]{csquotes}
\MakeAutoQuote{“}{”}
\MakeAutoQuote*{‘}{’} % innerquotes
Correspondingly, I have in my .emacs (under use-package's :custom):
(LaTeX-csquotes-open-quote "“")
(LaTeX-csquotes-close-quote "”")
(LaTeX-csquotes-quote-after-quote nil)
I also have there:
(custom-set-variables
...
'(electric-quote-mode t)
...
)
AUCTeX support for quotes works of course, but has some inconveniences. First, it uses a different keyboard key for inserting quotes (double quote for AUCTeX and backtick for everything else with electric quote mode). Second, I can't seem to find a way to insert curved single quotes. Third, neither alternative works at all in BibTeX mode.
For quite sometime, I thought this problem had to do with something in my document which got parsed by AUCTeX. Indeed, opening a blank buffer and manually changing to LaTeX-mode gets me a buffer with a working electric quote mode. But, in testing further, I don't think this is the case. Consider the following minimal document:
\documentclass{article}
\begin{document}
\end{document}
If I let AUCTeX parse this document, producing the following auto/test.el:
(TeX-add-style-hook
"test"
(lambda ()
(TeX-run-style-hooks
"latex2e"
"article"
"art10"))
:latex)
And then reopen it, electric-quote-mode no longer works (the backtick key inserts a plain backtick).
One possible source of conflict I considered is the math mode prefix, which is mapped to the backtick key by default. But I don't usually enable LaTeX-math-mode and even setting LaTeX-math-abbrev-prefix to "'" I still could not get electric quote mode to work.
In checking the keymap to the backtik (C-h k backtick) I see that it is mapped to self-insert-command in both LaTeX-mode and BibTeX-mode.
Any thoughts on why this fails and how I could get it to work?