bug-auctex
[Top][All Lists]

## bug#48365: 13.0.11; Dollars in distinct comments trigger math mode highl

 From: Ikumi Keita Subject: bug#48365: 13.0.11; Dollars in distinct comments trigger math mode highlighting in text in-between Date: Thu, 13 May 2021 15:00:23 +0900

>>>>> Tassilo Horn <tsdh@gnu.org> writes:
> Works like a charm, and good catch!  How did you find the culprit?

> With jit-lock-debug-mode' I get as far as getting a message

>   Error running timer ‘jit-lock--debug-fontify’: (end-of-buffer)

> which clearly tells we're trying to moe farther than end of buffer but
> still there is no indication where we're doing that.  Do you have some
> trick I'm not aware of yet?

No, just ordinary hand debug with edebug as an auxiliary tool. :-)

A possible advantage for me is that I encountered a similar example
before and saved it for future debug:
----------------------------------------------------------------------
\documentclass{article}

\begin{document}
\verb|^=}{\|
\verb$'&\$
$aaa$
\verb|a$bc$d|
\end{document}

%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:
----------------------------------------------------------------------
>From Jean's example, I learned that unclosed dollar sign is involved in
this symptom. So I suspected that dollar fontification causes some error
to interrupt font lock, ending up with partial fontification.
(1) After some unsuccessful tries&errors, I put the point just before
the last $in the Jean's example and did M-: (font-latex-match-dollar-math (point-max)) RET (2) Emacs signaled end-of-buffer error. So I could be confident that the problem hides in font-latex-match-dollar-math' or the vicinity of it. (3) I enabled edebug for font-latex-match-dollar-math' and tried M-: (font-latex-match-dollar-math (point-max)) RET after putting the point before the last$ again.
(4) Then I noticed that the second call to
font-latex-find-dollar-math' returns t, which should be nil because
this last \$ is unclosed in the buffer.
(5) I looked at font-latex-find-dollar-math' carefully and noticed that
it returns false t if LIMIT argument exceeds end of buffer.

Regards,
Ikumi Keita

`

reply via email to