GNU bug report logs - #48365
13.0.11; Dollars in distinct comments trigger math mode highlighting in text in-between

Previous Next

Package: auctex;

Reported by: jfbu <jfbu <at> free.fr>

Date: Tue, 11 May 2021 19:18:01 UTC

Severity: normal

Found in version 13.0.11

Done: Ikumi Keita <ikumi <at> ikumi.que.jp>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Ikumi Keita <ikumi <at> ikumi.que.jp>
To: Tassilo Horn <tsdh <at> gnu.org>
Cc: 48365 <at> debbugs.gnu.org, JF <jfbu <at> free.fr>
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 <at> 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




This bug report was last modified 4 years and 73 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.