Subject: Re: bug#68827: Possible solution
From: Stefan Monnier <[email-masked]>
To: Gabriele Nicolardi <[email-masked]>
Cc: [email-masked]
Date: Thu, 15 Feb 2024 15:11:43 -0500
List-Id: <debbugs-submit.debbugs.gnu.org>

> I noticed that the tex-verbatim face used in latex-mode to highlight the
> \href argument has priority on font-lock-comment-face.

I'm not sure if it should qualify as a bug or as a feature, to be honest.

> (font-lock-add-keywords nil
>  '(("\\\(ProvidesFile\|href\|nolinkurl\|path\|url\) \(\[[^]]\]
>  \){\(\(?:[^{}\]\|\\.\|{[^}]}\)+\)" 3 'tex-verbatim keep)))

Thanks.  `keep` seems right for the case where the match is inside
a comment, as in your case, but there are other cases where we want
to override the previously applied face (e.g. $math$).

I pushed a patch which re-arranges the rules to avoid that
other problem.

        Stefan