unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* show-paren-when-point-inside-paren
@ 2022-06-20  3:29 carlmarcos--- via Users list for the GNU Emacs text editor
  2022-06-20 10:58 ` show-paren-when-point-inside-paren Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: carlmarcos--- via Users list for the GNU Emacs text editor @ 2022-06-20  3:29 UTC (permalink / raw)
  To: Help Gnu Emacs

Have been trying out 

(setq show-paren-when-point-inside-paren t)

This only works when cursor is just inside the opening parens.  Is this how it is supposed to work?
The name itself has tendency for confusion.

If it was me, I would not mix the highlighting of parens with highlighting of expressions.  Instead have two autonomous functionalities, one for highlighting parens only, another to highlight expressions only.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: show-paren-when-point-inside-paren
  2022-06-20  3:29 show-paren-when-point-inside-paren carlmarcos--- via Users list for the GNU Emacs text editor
@ 2022-06-20 10:58 ` Eli Zaretskii
  2022-06-20 13:10   ` show-paren-when-point-inside-paren carlmarcos--- via Users list for the GNU Emacs text editor
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2022-06-20 10:58 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Mon, 20 Jun 2022 05:29:52 +0200 (CEST)
> From: carlmarcos--- via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>
> 
> Have been trying out 
> 
> (setq show-paren-when-point-inside-paren t)
> 
> This only works when cursor is just inside the opening parens.  Is this how it is supposed to work?

Yes.

> The name itself has tendency for confusion.

You are supposed to read the doc string, not just the name.  Names
cannot be too long, because it becomes inconvenient.  And the doc
string explicitly answers your question.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: show-paren-when-point-inside-paren
  2022-06-20 10:58 ` show-paren-when-point-inside-paren Eli Zaretskii
@ 2022-06-20 13:10   ` carlmarcos--- via Users list for the GNU Emacs text editor
  2022-06-20 13:36     ` show-paren-when-point-inside-paren Eli Zaretskii
  2022-06-20 13:36     ` show-paren-when-point-inside-paren Rudolf Schlatte
  0 siblings, 2 replies; 6+ messages in thread
From: carlmarcos--- via Users list for the GNU Emacs text editor @ 2022-06-20 13:10 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: help-gnu-emacs



Jun 20, 2022, 10:58 by eliz@gnu.org:

>> Date: Mon, 20 Jun 2022 05:29:52 +0200 (CEST)
>> From: carlmarcos--- via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>
>>
>> Have been trying out 
>>
>> (setq show-paren-when-point-inside-paren t)
>>
>> This only works when cursor is just inside the opening parens.  Is this how it is supposed to work?
>>
>
> Yes.
>
>> The name itself has tendency for confusion.
>>
>
> You are supposed to read the doc string, not just the name.  Names
> cannot be too long, because it becomes inconvenient.  And the doc
> string explicitly answers your question.
>
Could this simply be included as a style for `show-paren-style`?  Showing the parens
wherever point you are in paren would also be useful.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: show-paren-when-point-inside-paren
  2022-06-20 13:10   ` show-paren-when-point-inside-paren carlmarcos--- via Users list for the GNU Emacs text editor
@ 2022-06-20 13:36     ` Eli Zaretskii
  2022-06-20 14:20       ` show-paren-when-point-inside-paren carlmarcos--- via Users list for the GNU Emacs text editor
  2022-06-20 13:36     ` show-paren-when-point-inside-paren Rudolf Schlatte
  1 sibling, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2022-06-20 13:36 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Mon, 20 Jun 2022 15:10:36 +0200 (CEST)
> From: carlmarcos@tutanota.com
> Cc: help-gnu-emacs@gnu.org
> 
> Could this simply be included as a style for `show-paren-style`?  Showing the parens
> wherever point you are in paren would also be useful.

No, because this isn't a style, it's orthogonal to the style.

Style says _how_ to highlight, whereas this variable says _when_ to
highlight.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: show-paren-when-point-inside-paren
  2022-06-20 13:10   ` show-paren-when-point-inside-paren carlmarcos--- via Users list for the GNU Emacs text editor
  2022-06-20 13:36     ` show-paren-when-point-inside-paren Eli Zaretskii
@ 2022-06-20 13:36     ` Rudolf Schlatte
  1 sibling, 0 replies; 6+ messages in thread
From: Rudolf Schlatte @ 2022-06-20 13:36 UTC (permalink / raw)
  To: help-gnu-emacs

carlmarcos--- via Users list for the GNU Emacs text editor
<help-gnu-emacs@gnu.org> writes:

> Showing the parens wherever point you are in paren would also be
> useful.

The highlight-parentheses package implements this:
https://sr.ht/~tsdh/highlight-parentheses.el/




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: show-paren-when-point-inside-paren
  2022-06-20 13:36     ` show-paren-when-point-inside-paren Eli Zaretskii
@ 2022-06-20 14:20       ` carlmarcos--- via Users list for the GNU Emacs text editor
  0 siblings, 0 replies; 6+ messages in thread
From: carlmarcos--- via Users list for the GNU Emacs text editor @ 2022-06-20 14:20 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: help-gnu-emacs

Jun 20, 2022, 13:36 by eliz@gnu.org:

>> Date: Mon, 20 Jun 2022 15:10:36 +0200 (CEST)
>> From: carlmarcos@tutanota.com
>> Cc: help-gnu-emacs@gnu.org
>>
>> Could this simply be included as a style for `show-paren-style`?  Showing the parens
>> wherever point you are in paren would also be useful.
>>
>
> No, because this isn't a style, it's orthogonal to the style.
>
> Style says _how_ to highlight, whereas this variable says _when_ to
> highlight.
>
Which means that one can have  `(setq 'show-paren-style 'parenthesis)` and 
`(setq 'show-paren-when-point-inside-paren t)` working concurrently.

The following are just some thoughts.

Emacs can do without variable `show-paren-when-point-inside-paren`.  Because `(setq 'show-paren-style 'parenthesis)` highlights parentheses depending on the position of point.  This holds also for 
`(setq 'show-paren-style 'expression)` and `(setq 'show-paren-style 'mixed)` (the latter requiring matching parenthesis to be outside the window pane).

Have also noticed that with `(setq 'show-paren-style 'parenthesis)` and `(setq 'show-paren-style 'mixed)`, the style overrides the `show-paren-when-point-inside-paren` setting.  

An enhancement to   `(setq 'show-paren-style 'expression)` can also be made such that the sexp at the current point can be highlighted.  Thus, if cursor is between two sexp's inside a structure (e.g. an `if` condition) the entire structure can be highlighted.





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-06-20 14:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-20  3:29 show-paren-when-point-inside-paren carlmarcos--- via Users list for the GNU Emacs text editor
2022-06-20 10:58 ` show-paren-when-point-inside-paren Eli Zaretskii
2022-06-20 13:10   ` show-paren-when-point-inside-paren carlmarcos--- via Users list for the GNU Emacs text editor
2022-06-20 13:36     ` show-paren-when-point-inside-paren Eli Zaretskii
2022-06-20 14:20       ` show-paren-when-point-inside-paren carlmarcos--- via Users list for the GNU Emacs text editor
2022-06-20 13:36     ` show-paren-when-point-inside-paren Rudolf Schlatte

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).