GNU bug report logs - #78396
[PATCH] Add option for not highlight parens inside comments or strings.

Previous Next

Package: emacs;

Reported by: Elijah Gabe Pérez <eg642616 <at> gmail.com>

Date: Mon, 12 May 2025 18:53:01 UTC

Severity: normal

Tags: patch

Done: Eli Zaretskii <eliz <at> gnu.org>

Full log


Message #17 received at 78396 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Elijah Gabe Pérez <eg642616 <at> gmail.com>,
 78396 <at> debbugs.gnu.org
Subject: Re: bug#78396: [PATCH] Add option for not highlight parens inside
 comments or strings.
Date: Tue, 27 May 2025 17:02:20 -0400
>> Sometimes show-paren will highlight the parens that are inside a
>> comment/string which looks annoying and somewhat confusing.
>>
>> e.g.
>> show-paren will highlight this paren:
>> 
>>   ;; :^)| <- cursor
>>        ^ paren highlighted as mismatch
>> 
>> or:
>>   v
>>   (
>>  ;; )| <- cursor
>>     ^ both parens highlighted

Ideally, we'd want to match closing-parens-in-comments with
opening-parens-in-comments.  But yes, it's good to refrain from giving
the above bogus highlighting.

>> I've made an option for disable/control this behavior, by default its
>> disabled but I wonder if this should be activated instead.
> I'm worried by using syntax-ppss-context here: couldn't it sometimes
> significantly slow down the highlighting of parens?  Stefan, WDYT?

`syntax-ppss` is not cheap, but here it's not used inside a loop and
should be called only once per user-interaction so I'm not worried.
I see there are two calls, tho, so I'd try to consolidate them so we call
it at most once.


        Stefan





This bug report was last modified 10 days ago.

Previous Next


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