GNU bug report logs -
#78396
[PATCH] Add option for not highlight parens inside comments or strings.
Previous Next
Full log
Message #8 received at 78396 <at> debbugs.gnu.org (full text, mbox):
> From: Elijah Gabe Pérez <eg642616 <at> gmail.com>
> Date: Mon, 12 May 2025 12:51:57 -0600
>
> 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
>
> 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?
> +@vindex show-paren-not-in-comments-or-strings
> +@code{show-paren-not-in-comments-or-strings}, If set to @code{all}, do
^^
That "If" should be in lower case.
> +not highlight all the parens that are inside comments or strings. If
> +set to @code{on-mismatch}, only don't highlight if paren mismatched. If set
> +to @code{nil} (by default), highlight the paren wherever it is.
The style here is not appropriate for the manual, it is a style for
the doc string. I'd use something like
If the value of @code{show-paren-not-in-comments-or-strings} is
@code{all}, delimiters inside comments and strings will not be
highlighted.
> +** New user option 'show-paren-not-in-comments-or-strings'
The period at the end of this heading line is missing.
> +This option tells show-paren don't highlight the parens that are inside
^^^^^^^^^^^^^^^
"not to highlight"
> +(defcustom show-paren-not-in-comments-or-strings nil
> + "Do not highlight the parens that are inside a comment or string.
> +If set to `all', do not highlight all the parens that are inside comments
> +or strings.
> +If set to `on-mismatch', only don't highlight if paren mismatched.
> +If set to nil (by default), highlight the paren wherever it is."
> + :type '(choice
> + (const :tag "Enable" all)
"Enable" is not a good tag here, because this feature actually
_disables_ highlighting. I would use "Never highlight" instead.
> + (const :tag "Only on mismatch" on-mismatch)
And here I'd use "Don't highlight when mismatched".
This bug report was last modified 11 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.