1

I running Emacs 25 on Debian 9.0 stretch. The version is 25.1+1-4+deb9u1.

I have a local copy of AUCTeX installed via Melpa. The relevant line in M-x list-packages is:

auctex           11.88.3       installed       Integrated environment for *TeX*

See the screenshot below. The text

\url\expandafter{\

in the macro \PrintDocTable is highlighted in brown and is a larger size for no apparent reason. This is also messing up bracket matching, which is really what bought it to my attention. For me, this falls into the trivial bug aggravating category.

Suggestions to debug are appreciated.

  1. If I copy this to another file, this issue disappears.
  2. Copying between buffers in emacs also makes the issue disappear.
  3. Running M-x latex-mode also makes the issue disappear, but it reappears on re-opening the file.

enter image description here

  • can you post the actual text shown in your screenshot? It would make it easier to reproduce the problem - we can't copy and paste from your image – Tyler May 23 '18 at 20:26
  • @Tyler Excellent point - I didn't think of that. Will do that now. Would a gist-paste be good, or should I include the entire text into the question? It's quite long. Or should I do both? – Faheem Mitha May 23 '18 at 20:27
  • I could also post my .emacs if that is helpful. – Faheem Mitha May 23 '18 at 20:43
  • Which version of AUCTeX are you using? And how did you install it? – Arash Esbati May 23 '18 at 20:43
  • For some reason, it looks like I don't have the Debian AUCTeX installed. So it might be a local install. Assuming I'm using the Emacs package manager, how can I find this out? – Faheem Mitha May 23 '18 at 20:48
1

With the latest version of AUCTeX, your example looks like this for me:

enter image description here

url command looks for its argument in braces (\url{arg}) or in delimiters (\url|arg|). In your case, it takes \ as the delimiter and fontifies everything until next \, i.e. expandafter{.

I suggest you update your AUCTeX installation via ELPA. But even with the updated version, the fontification will not match your expectation. AUCTeX doesn't parse your document in order to see and understand the \expandafter.

The brace matching confusion is also a result of the fontification (aka syntax highlighting): Within \url\expandafter{\, { is not treated as an opening brace, but as ordinary text. Hence the behavior you observe.

You can turn off fontification (aka syntax highlighting) in your .sty file with M-x font-lock-mode RET which will restore the correct parsing of braces. I wouldn't consider this a bug: AUCTeX is optimized for writing LaTeX files and not hacking .sty files.

  • I think I'm missing the implications of your answer. Are you saying you are seeing similar syntax to what I'm seeing. But does it mess up bracket matching? And is my AUCTeX version a problem or not? – Faheem Mitha May 23 '18 at 21:02
  • @FaheemMitha - See my updated answer. – Arash Esbati May 23 '18 at 21:05
  • The fontification isn't a problem per se. But the bracket matching getting screwed up is. And why does this fontification come and go? Are you seeing any problems with bracket matching? – Faheem Mitha May 23 '18 at 21:07
  • And I did the AUCTeX upgrade, but I'm still seeing the bracket matching problem. – Faheem Mitha May 23 '18 at 21:11
  • I could post another image of the bracket matching issue, if that would help. – Faheem Mitha May 23 '18 at 21:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.