GNU bug report logs - #55202
27.1 Feature request: Show parens when point is anywhere inside of them

Previous Next

Package: emacs;

Reported by: José Júnior <jjnilton <at> gmail.com>

Date: Sun, 1 May 2022 02:34:01 UTC

Severity: wishlist

Found in version 27.1

To reply to this bug, email your comments to 55202 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#55202; Package emacs. (Sun, 01 May 2022 02:34:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to José Júnior <jjnilton <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 01 May 2022 02:34:01 GMT) Full text and rfc822 format available.

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

From: José Júnior <jjnilton <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 27.1 Feature request: Show parens when point is anywhere inside of
 them
Date: Sat, 30 Apr 2022 23:32:55 -0300
[Message part 1 (text/plain, inline)]
How can I set emacs to show parens when the point is anywhere inside of
them?

For example, with the point in the character "i": (po|int)

Coming from other editors, I expect that the parens are highlighted, but in
emacs they're only highlighted the point is on paren or immediately after
it, even with the variable "Show Paren When Point Inside Paren" set to "on".
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55202; Package emacs. (Sun, 01 May 2022 08:44:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: José Júnior <jjnilton <at> gmail.com>
Cc: 55202 <at> debbugs.gnu.org
Subject: Re: bug#55202: 27.1 Feature request: Show parens when point is
 anywhere inside of them
Date: Sun, 01 May 2022 10:43:01 +0200
José Júnior <jjnilton <at> gmail.com> writes:

> How can I set emacs to show parens when the point is anywhere inside of them?
>
> For example, with the point in the character "i": (po|int)
>
> Coming from other editors, I expect that the parens are highlighted,
> but in emacs they're only highlighted the point is on paren or
> immediately after it, even with the variable "Show Paren When Point
> Inside Paren" set to "on".

That variable doc says "If non-nil, show parens when point is just
inside one.", so when point is right by the paren.

Anyway, I think it would make sense to add what you're requesting -- but
I'm not sure it would be efficient, or that it's well-defined.  For
instance, if you're in text-mode and the text is

  {(foo|bar})

what should it be blinking?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55202; Package emacs. (Sun, 01 May 2022 09:18:02 GMT) Full text and rfc822 format available.

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

From: Rudolf Schlatte <rudi <at> constantly.at>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#55202: 27.1 Feature request: Show parens when point is
 anywhere inside of them
Date: Sun, 01 May 2022 11:17:11 +0200
José Júnior <jjnilton <at> gmail.com> writes:

> How can I set emacs to show parens when the point is anywhere inside of them?

If you are comfortable with installing packages, "highlight parentheses"
(https://sr.ht/~tsdh/highlight-parentheses.el/) implements this.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55202; Package emacs. (Sun, 01 May 2022 13:20:02 GMT) Full text and rfc822 format available.

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

From: José Júnior <jjnilton <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 55202 <at> debbugs.gnu.org
Subject: Re: bug#55202: 27.1 Feature request: Show parens when point is
 anywhere inside of them
Date: Sun, 1 May 2022 10:19:15 -0300
[Message part 1 (text/plain, inline)]
>
> That variable doc says "If non-nil, show parens when point is just
> inside one.", so when point is right by the paren.


Thanks for the explanation.

Anyway, I think it would make sense to add what you're requesting -- but
> I'm not sure it would be efficient, or that it's well-defined.  For
> instance, if you're in text-mode and the text is
>
>   {(foo|bar})
>
> what should it be blinking?
>

I didn't know how to answer, so I looked how other editors do. I found two
behaviors:

1. Unless the point is right by the parens, it should highlight the curly
braces. So in this case it would highlight the curly braces.

With the point in these places would highlight the parens, otherwise would
highlight the curly braces:

{|(|foobar}|)|

2. Ignore and don't highlight anything.

On Sun, May 1, 2022 at 5:43 AM Lars Ingebrigtsen <larsi <at> gnus.org> wrote:

> José Júnior <jjnilton <at> gmail.com> writes:
>
> > How can I set emacs to show parens when the point is anywhere inside of
> them?
> >
> > For example, with the point in the character "i": (po|int)
> >
> > Coming from other editors, I expect that the parens are highlighted,
> > but in emacs they're only highlighted the point is on paren or
> > immediately after it, even with the variable "Show Paren When Point
> > Inside Paren" set to "on".
>
> That variable doc says "If non-nil, show parens when point is just
> inside one.", so when point is right by the paren.
>
> Anyway, I think it would make sense to add what you're requesting -- but
> I'm not sure it would be efficient, or that it's well-defined.  For
> instance, if you're in text-mode and the text is
>
>   {(foo|bar})
>
> what should it be blinking?
>
> --
> (domestic pets only, the antidote for overdose, milk.)
>    bloggy blog: http://lars.ingebrigtsen.no
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55202; Package emacs. (Mon, 02 May 2022 08:05:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: José Júnior <jjnilton <at> gmail.com>
Cc: 55202 <at> debbugs.gnu.org
Subject: Re: bug#55202: 27.1 Feature request: Show parens when point is
 anywhere inside of them
Date: Mon, 02 May 2022 10:04:20 +0200
José Júnior <jjnilton <at> gmail.com> writes:

> I didn't know how to answer, so I looked how other editors do. I found two behaviors: 
>
> 1. Unless the point is right by the parens, it should highlight the curly braces. So in
> this case it would highlight the curly braces.
>
> With the point in these places would highlight the parens, otherwise would highlight
> the curly braces:
>
> {|(|foobar}|)| 
>
> 2. Ignore and don't highlight anything.

I guess 2) seems more consistent, but I don't have much of an opinion.
Choosing one or the other of the parentheses seems a bit arbitrary. 

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55202; Package emacs. (Tue, 03 May 2022 02:12:02 GMT) Full text and rfc822 format available.

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

From: José Júnior <jjnilton <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 55202 <at> debbugs.gnu.org
Subject: Re: bug#55202: 27.1 Feature request: Show parens when point is
 anywhere inside of them
Date: Mon, 2 May 2022 23:10:36 -0300
[Message part 1 (text/plain, inline)]
I've been using this workaround so far, and it seems to work (like the
first option, though):

(define-advice show-paren-function (:around (fn) fix)
  "Highlight enclosing parens."
  (cond ((looking-at-p "\\s(") (funcall fn))
        (t (save-excursion
             (ignore-errors (backward-up-list))
             (funcall fn)))))

source
<https://stackoverflow.com/questions/34846531/show-parentheses-when-inside-them-emacs>

I don't know about efficiency, but I haven't tried it in deeply nested
blocks.

On Mon, May 2, 2022 at 5:04 AM Lars Ingebrigtsen <larsi <at> gnus.org> wrote:

> José Júnior <jjnilton <at> gmail.com> writes:
>
> > I didn't know how to answer, so I looked how other editors do. I found
> two behaviors:
> >
> > 1. Unless the point is right by the parens, it should highlight the
> curly braces. So in
> > this case it would highlight the curly braces.
> >
> > With the point in these places would highlight the parens, otherwise
> would highlight
> > the curly braces:
> >
> > {|(|foobar}|)|
> >
> > 2. Ignore and don't highlight anything.
>
> I guess 2) seems more consistent, but I don't have much of an opinion.
> Choosing one or the other of the parentheses seems a bit arbitrary.
>
> --
> (domestic pets only, the antidote for overdose, milk.)
>    bloggy blog: http://lars.ingebrigtsen.no
>
[Message part 2 (text/html, inline)]

This bug report was last modified 3 years and 48 days ago.

Previous Next


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