Subject: bug#39686: 25.2; Wrong behaviour of bibtex-autokey-name-change-strings

From: Mattias Engdegård <[email-masked]>
Date: Fri, 21 Feb 2020 21:43:08 +0100

21 feb. 2020 kl. 21.03 skrev Roland Winkler <[email-masked]>:

> In LaTeX syntax, OLD-REGEXP can appear anywhere inside what LaTeX
> considers a word (which even may include spaces).  So to make things
> more fool-proofed, it would be necessary to parse more carefully the
> LaTeX code.  I do not think this effort is needed here as these
> regexps have worked well for at least two decades.  The patch fixes
> a minor problem of these regexps pointed out by the OP.  But
> otherwise it preserves their spirit.

In LaTeX you can't just write 'b\oeuf'; it will complain that '\oeuf' is undefined. You have to write 'b\oe uf' or 'b{\oe}uf'. Thus there is a word break at the end. (Accents, like '\"o', are different; there is only a single letter after the '\"'.)
With your table, you replace '\o' with 'oe', but what if the text uses a different \-sequence starting with \o, like '\omega'? After substitution, you would have 'oemega' which wasn't intended.

Safer then to tack on a zero-width assertion, like

"\\\\\\(?:o\\|oe\\)\\>"

for example. Or, if you think it's hard to read,

(rx "\\" (or "o" "oe") word-end)