[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [AUCTeX] Get Emacs' electric quote mode to work with AUCTeX and BibT
From: |
gusbrs . 2016 |
Subject: |
Re: [AUCTeX] Get Emacs' electric quote mode to work with AUCTeX and BibTeX mode |
Date: |
Sun, 4 Nov 2018 16:23:59 -0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 |
Hi all,
For the record, I was able to solve this issue for AUCTeX by debugging
my init
file and find a workaround for BibTeX by getting a better grasp of
electric-quote-mode.
As to the problems with AUCTeX, the culprit was that I, when moving to
use-package, added the following to my init file:
(use-package latex
:ensure auctex
:mode ("\\.tex\\'" . TeX-latex-mode)
... etc ...)
I don't really recall why I've set it to TeX-latex-mode. I've actually
researched quite a lot around to move AUCTeX to use-package, perhaps too
much...
The fact is that either:
(use-package latex
:ensure auctex
:mode ("\\.tex\\'" . LaTeX-mode)
... etc ...)
or, even simpler:
(use-package latex
:ensure auctex
:defer t
... etc ...)
gets the job done and, with a working electric-quote-mode. I don't know
why the
problem arose in the first place, but that fixed it.
As to BibTeX-mode, the problem is that electric-quote-mode is designed
to work
only in paragraphs, comments and strings, according to the state of,
respectively, electric-quote-paragraph, electric-quote-comment and
electric-quote-string (the first two being t and the third nil, by default).
I don't know what Emacs considers a BibTeX buffer (not even outside an
entry,
electric quote works). But, this suggested the following workaround. I can
comment the line of interest with "C-x C-;". With the line commented,
electric-quote then works. I edit the line to my desire, and uncomment
it back
with "C-x C-;". That's less than optimal, of course, but should be
enough for
the eventual case when a title contains quotes within it, which is the only
actual case I can think of where this is needed.
I thank those that gave their attention to the question, even if
silently (As it
turns out, I didn't give you enough information to reproduce the issue.
Sorry
about that). And thank you all for the great software.
Best,
gusbrs
On 19/10/2018 19:05, address@hidden wrote:
Hi all,
[Disclaimer: I've asked this question before at TeX.SE
(https://tex.stackexchange.com/q/454912/105447) but, after due wait, I
thought
it was worth to bring the issue to this list, in the hope anyone else
has any
ideas or suggestions on the matter.]
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
in my
settings. 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.
I'm running Emacs 26.1 with AUCTeX 12.1.1.
Any thoughts on why this happens and how I could get it to work?
I thank you in advance.
Best,
gusbrs
PS: I'd also welcome suggestions outside this framework. I might well
be looking
at the problem from the wrong perspective.
PPS: I'm not sure this is the proper place to ask about this issue
also in
BibTeX mode. I suppose it is close enough that someone here might have
some
ideas on the matter. But, if it's not, I'd appreciate pointers on
where would be
more appropriate to ask.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [AUCTeX] Get Emacs' electric quote mode to work with AUCTeX and BibTeX mode,
gusbrs . 2016 <=