Hi everyone!
It seems that AUCTeX by default treats colon ":" and underscore "_" as word parts; more generally,
'backward-kill-work' will stop at ":" and "_". A while ago, after some help here from Arash (see old emails
below), I managed to modify their syntax to "punctuation" by adding these lines in my TeX-hook:
(modify-syntax-entry ?: "." LaTeX-expl3-syntax-table)
(modify-syntax-entry ?_ "." LaTeX-expl3-syntax-table)
In the last version of AUCTeX, 'LaTeX-expl3-syntax-table' seems not to exist anymore (something in relation
to this was discussed by Arash as well). I was wondering how's the correct way to modify the syntax of
":" and "_" in AUCTeX-latex buffers now. I tried with all syntax tables listed by Emacs
that have a "tex" in them, but no luck.
Cheers!
Luca
On 260121 12:54, [email protected] wrote:
Thank you Arash! Indeed the culprit is siunitx.sty. Using
(modify-syntax-entry ?: "." LaTeX-expl3-syntax-table)
(modify-syntax-entry ?_ "." LaTeX-expl3-syntax-table)
Fixed my problem.
I agree with your comment on expl3.el!
Kind regards,
Luca
On 260121 12:12, Arash Esbati wrote:
pglpm--- via General discussion about AUCTeX <[email protected]> writes:
Of late I'm noticing that colon ":" and underscore "_" are treated as
part of words, as confirmed by looking at the syntax table. Just as a
curiosity: is this a recent change, or is my memory simply failing me?
In the archives I found a discussion about this around 2012.
I'd like to treat those characters as punctuation, so that if I have,
say, "eq:blah" with point at the end, and I back-delete a word, I
should be left with "eq:". In my hook for LaTeX I therefore added
(modify-syntax-entry ?: "." LaTeX-mode-syntax-table)
(modify-syntax-entry ?_ "." LaTeX-mode-syntax-table)
but they don't seem to have any effect. Probably I'm doing something
wrong but I can't find out what. Any tips?
I think this is due to this change[1]. By chance, are you using one of
these packages in your .tex file:
acro.sty
figureversions.sty
fontspec.sty
l3doc.sty
siunitx.sty
unicode-math.sty
They all run the style hook for expl3.el which then changes the syntax
for : and _. I think we should undo this in the AUCTeX styles above
since expl3.el is not relevant for users with ordinary .tex files.
Best, Arash
Footnotes:
[1]
https://cgit.git.savannah.gnu.org/cgit/auctex.git/commit/style/expl3.el?id=db11f39d36e9b78e3a5405076249f3b7c3f8d1f6