* bug#55202: 27.1 Feature request: Show parens when point is anywhere inside of them
@ 2022-05-01 2:32 José Júnior
2022-05-01 8:43 ` Lars Ingebrigtsen
2022-05-01 9:17 ` Rudolf Schlatte
0 siblings, 2 replies; 6+ messages in thread
From: José Júnior @ 2022-05-01 2:32 UTC (permalink / raw)
To: 55202
[-- Attachment #1: Type: text/plain, Size: 366 bytes --]
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".
[-- Attachment #2: Type: text/html, Size: 515 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#55202: 27.1 Feature request: Show parens when point is anywhere inside of them
2022-05-01 2:32 bug#55202: 27.1 Feature request: Show parens when point is anywhere inside of them José Júnior
@ 2022-05-01 8:43 ` Lars Ingebrigtsen
2022-05-01 13:19 ` José Júnior
2022-05-01 9:17 ` Rudolf Schlatte
1 sibling, 1 reply; 6+ messages in thread
From: Lars Ingebrigtsen @ 2022-05-01 8:43 UTC (permalink / raw)
To: José Júnior; +Cc: 55202
José Júnior <jjnilton@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
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#55202: 27.1 Feature request: Show parens when point is anywhere inside of them
2022-05-01 2:32 bug#55202: 27.1 Feature request: Show parens when point is anywhere inside of them José Júnior
2022-05-01 8:43 ` Lars Ingebrigtsen
@ 2022-05-01 9:17 ` Rudolf Schlatte
1 sibling, 0 replies; 6+ messages in thread
From: Rudolf Schlatte @ 2022-05-01 9:17 UTC (permalink / raw)
To: 55202
José Júnior <jjnilton@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.
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#55202: 27.1 Feature request: Show parens when point is anywhere inside of them
2022-05-01 8:43 ` Lars Ingebrigtsen
@ 2022-05-01 13:19 ` José Júnior
2022-05-02 8:04 ` Lars Ingebrigtsen
0 siblings, 1 reply; 6+ messages in thread
From: José Júnior @ 2022-05-01 13:19 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: 55202
[-- Attachment #1: Type: text/plain, Size: 1847 bytes --]
>
> 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@gnus.org> wrote:
> José Júnior <jjnilton@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
>
[-- Attachment #2: Type: text/html, Size: 2936 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#55202: 27.1 Feature request: Show parens when point is anywhere inside of them
2022-05-01 13:19 ` José Júnior
@ 2022-05-02 8:04 ` Lars Ingebrigtsen
2022-05-03 2:10 ` José Júnior
0 siblings, 1 reply; 6+ messages in thread
From: Lars Ingebrigtsen @ 2022-05-02 8:04 UTC (permalink / raw)
To: José Júnior; +Cc: 55202
José Júnior <jjnilton@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
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#55202: 27.1 Feature request: Show parens when point is anywhere inside of them
2022-05-02 8:04 ` Lars Ingebrigtsen
@ 2022-05-03 2:10 ` José Júnior
0 siblings, 0 replies; 6+ messages in thread
From: José Júnior @ 2022-05-03 2:10 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: 55202
[-- Attachment #1: Type: text/plain, Size: 1356 bytes --]
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@gnus.org> wrote:
> José Júnior <jjnilton@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
>
[-- Attachment #2: Type: text/html, Size: 1979 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-05-03 2:10 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-01 2:32 bug#55202: 27.1 Feature request: Show parens when point is anywhere inside of them José Júnior
2022-05-01 8:43 ` Lars Ingebrigtsen
2022-05-01 13:19 ` José Júnior
2022-05-02 8:04 ` Lars Ingebrigtsen
2022-05-03 2:10 ` José Júnior
2022-05-01 9:17 ` Rudolf Schlatte
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.