Subject: Re: bug#78396: [PATCH] Add option for not highlight parens inside comments or strings.

From: Stefan Monnier <[email-masked]>
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