* bug#73688: [PATCH] electric-pair-mode - preserve balance in conservative mode
@ 2024-10-08 3:10 Marc Soda
2024-10-12 12:21 ` Eli Zaretskii
2024-10-17 16:48 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 2 replies; 16+ messages in thread
From: Marc Soda @ 2024-10-08 3:10 UTC (permalink / raw)
To: 73688
[-- Attachment #1.1: Type: text/plain, Size: 1407 bytes --]
When using electric-pair-mode, electric-pair-conservative-inhibit
doesn't respect electric-pair-preserve-balance. For example, type out a
string, go to the beginning of the line, type ", go to the end of the
line, and type ". You are left with "foo"". (Exact keys from the start
of a line are fooC-a"C-e", if that's more clear.) I would expect to be
left with "foo" instead.
This is easy to resolve in your init file (after some digging), but I
think the current behavior is non-intuitive.
Please consider the attached patch.
In GNU Emacs 29.4 (build 2, x86_64-apple-darwin23.6.0, NS appkit-2487.70
Version 14.6.1 (Build 23G93)) of 2024-10-03 built on gemini.local
Windowing system distributor 'Apple', version 10.3.2566
System Description: macOS 15.0.1
Configured using:
'configure --disable-dependency-tracking --disable-silent-rules
--enable-locallisppath=/usr/local/share/emacs/site-lisp
--infodir=/usr/local/Cellar/emacs-plus@29/29.4/share/info/emacs
--prefix=/usr/local/Cellar/emacs-plus@29/29.4 --with-xml2 --with-gnutls
--with-native-compilation --without-compress-install --without-dbus
--without-imagemagick --with-modules --with-rsvg --with-ns
--disable-ns-self-contained 'CFLAGS=-O2 -DFD_SETSIZE=10000
-DDARWIN_UNLIMITED_SELECT -I/usr/local/opt/gcc/include
-I/usr/local/opt/libgccjit/include' 'LDFLAGS=-L/usr/local/lib/gcc/14
-I/usr/local/opt/gcc/include -I/usr/local/opt/libgccjit/include''
[-- Attachment #1.2: Type: text/html, Size: 2548 bytes --]
[-- Attachment #2: 0001-preserve-balance-in-conservative-mode.patch --]
[-- Type: application/octet-stream, Size: 1012 bytes --]
From 7b75b4d1447157fac733c6a1bf23b5e4b7362a65 Mon Sep 17 00:00:00 2001
From: Marc Soda <marc@soda.fm>
Date: Mon, 7 Oct 2024 22:54:33 -0400
Subject: [PATCH] preserve balance in conservative mode
---
lisp/elec-pair.el | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/lisp/elec-pair.el b/lisp/elec-pair.el
index c9627763d8d..382307503e8 100644
--- a/lisp/elec-pair.el
+++ b/lisp/elec-pair.el
@@ -200,7 +200,11 @@ be considered.")
(and (eq char (char-before))
(eq char (char-before (1- (point)))))
;; I also find it often preferable not to pair next to a word.
- (eq (char-syntax (following-char)) ?w)))
+ (eq (char-syntax (following-char)) ?w)
+ (eq (char-syntax (following-char)) ?w)
+ ;; Also consider preserving balance
+ (and electric-pair-preserve-balance
+ (electric-pair-inhibit-if-helps-balance char))))
(defmacro electric-pair--with-syntax (string-or-comment &rest body)
"Run BODY with appropriate syntax table active.
--
2.39.5 (Apple Git-154)
^ permalink raw reply related [flat|nested] 16+ messages in thread
* bug#73688: [PATCH] electric-pair-mode - preserve balance in conservative mode
2024-10-08 3:10 bug#73688: [PATCH] electric-pair-mode - preserve balance in conservative mode Marc Soda
@ 2024-10-12 12:21 ` Eli Zaretskii
2024-10-12 19:47 ` Marc Soda
2024-10-12 20:36 ` João Távora
2024-10-17 16:48 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
1 sibling, 2 replies; 16+ messages in thread
From: Eli Zaretskii @ 2024-10-12 12:21 UTC (permalink / raw)
To: Marc Soda, João Távora; +Cc: 73688
> Date: Tue, 08 Oct 2024 03:10:54 +0000
> From: Marc Soda <marc@soda.fm>
>
> When using electric-pair-mode, electric-pair-conservative-inhibit
> doesn't respect electric-pair-preserve-balance. For example, type out a
> string, go to the beginning of the line, type ", go to the end of the
> line, and type ". You are left with "foo"". (Exact keys from the start
> of a line are fooC-a"C-e", if that's more clear.) I would expect to be
> left with "foo" instead.
>
> This is easy to resolve in your init file (after some digging), but I
> think the current behavior is non-intuitive.
>
> Please consider the attached patch.
João, do you have any comments?
> diff --git a/lisp/elec-pair.el b/lisp/elec-pair.el
> index c9627763d8d..382307503e8 100644
> --- a/lisp/elec-pair.el
> +++ b/lisp/elec-pair.el
> @@ -200,7 +200,11 @@ be considered.")
> (and (eq char (char-before))
> (eq char (char-before (1- (point)))))
> ;; I also find it often preferable not to pair next to a word.
> - (eq (char-syntax (following-char)) ?w)))
> + (eq (char-syntax (following-char)) ?w) <<<<<<<<<<<<<<<<<<
> + (eq (char-syntax (following-char)) ?w) <<<<<<<<<<<<<<<<<<
> + ;; Also consider preserving balance
> + (and electric-pair-preserve-balance
> + (electric-pair-inhibit-if-helps-balance char))))
Why duplicate lines there?
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#73688: [PATCH] electric-pair-mode - preserve balance in conservative mode
2024-10-12 12:21 ` Eli Zaretskii
@ 2024-10-12 19:47 ` Marc Soda
2024-10-12 20:36 ` João Távora
1 sibling, 0 replies; 16+ messages in thread
From: Marc Soda @ 2024-10-12 19:47 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 73688, João Távora
[-- Attachment #1: Type: text/plain, Size: 1634 bytes --]
That was a silly typo on my part from when I created the patch. Thanks for catching. I attached a clean version.
Marc
On Saturday, October 12th, 2024 at 8:21 AM, Eli Zaretskii <eliz@gnu.org> wrote:
>
>
> > Date: Tue, 08 Oct 2024 03:10:54 +0000
>
> > From: Marc Soda marc@soda.fm
> >
> > When using electric-pair-mode, electric-pair-conservative-inhibit
> > doesn't respect electric-pair-preserve-balance. For example, type out a
> > string, go to the beginning of the line, type ", go to the end of the
> > line, and type ". You are left with "foo"". (Exact keys from the start
> > of a line are fooC-a"C-e", if that's more clear.) I would expect to be
> > left with "foo" instead.
> >
> > This is easy to resolve in your init file (after some digging), but I
> > think the current behavior is non-intuitive.
> >
> > Please consider the attached patch.
>
>
> João, do you have any comments?
>
> > diff --git a/lisp/elec-pair.el b/lisp/elec-pair.el
> > index c9627763d8d..382307503e8 100644
> > --- a/lisp/elec-pair.el
> > +++ b/lisp/elec-pair.el
> > @@ -200,7 +200,11 @@ be considered.")
> > (and (eq char (char-before))
> > (eq char (char-before (1- (point)))))
> > ;; I also find it often preferable not to pair next to a word.
> > - (eq (char-syntax (following-char)) ?w)))
> > + (eq (char-syntax (following-char)) ?w) <<<<<<<<<<<<<<<<<<
> > + (eq (char-syntax (following-char)) ?w) <<<<<<<<<<<<<<<<<<
> > + ;; Also consider preserving balance
> > + (and electric-pair-preserve-balance
> > + (electric-pair-inhibit-if-helps-balance char))))
>
>
> Why duplicate lines there?
[-- Attachment #2: 0001-preserve-balance-in-conservative-mode.patch --]
[-- Type: application/octet-stream, Size: 969 bytes --]
From 5883b8f22dac78be1f06e1c2760da2fb6fc8c327 Mon Sep 17 00:00:00 2001
From: Marc Soda <marc@soda.fm>
Date: Sat, 12 Oct 2024 15:44:28 -0400
Subject: [PATCH] preserve balance in conservative mode
---
lisp/elec-pair.el | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/lisp/elec-pair.el b/lisp/elec-pair.el
index c9627763d8d..71bc33ead26 100644
--- a/lisp/elec-pair.el
+++ b/lisp/elec-pair.el
@@ -200,7 +200,10 @@ be considered.")
(and (eq char (char-before))
(eq char (char-before (1- (point)))))
;; I also find it often preferable not to pair next to a word.
- (eq (char-syntax (following-char)) ?w)))
+ (eq (char-syntax (following-char)) ?w)
+ ;; Also consider preserving balance
+ (and electric-pair-preserve-balance
+ (electric-pair-inhibit-if-helps-balance char))))
(defmacro electric-pair--with-syntax (string-or-comment &rest body)
"Run BODY with appropriate syntax table active.
--
2.39.5 (Apple Git-154)
^ permalink raw reply related [flat|nested] 16+ messages in thread
* bug#73688: [PATCH] electric-pair-mode - preserve balance in conservative mode
2024-10-12 12:21 ` Eli Zaretskii
2024-10-12 19:47 ` Marc Soda
@ 2024-10-12 20:36 ` João Távora
2024-10-12 20:43 ` Marc Soda
1 sibling, 1 reply; 16+ messages in thread
From: João Távora @ 2024-10-12 20:36 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Marc Soda, 73688
On Sat, Oct 12, 2024 at 1:21 PM Eli Zaretskii <eliz@gnu.org> wrote:
>
> > Date: Tue, 08 Oct 2024 03:10:54 +0000
> > From: Marc Soda <marc@soda.fm>
> >
> > When using electric-pair-mode, electric-pair-conservative-inhibit
> > doesn't respect electric-pair-preserve-balance. For example, type out a
> > string, go to the beginning of the line, type ", go to the end of the
> > line, and type ". You are left with "foo"". (Exact keys from the start
> > of a line are fooC-a"C-e", if that's more clear.) I would expect to be
> > left with "foo" instead.
> >
> > This is easy to resolve in your init file (after some digging), but I
> > think the current behavior is non-intuitive.
> >
> > Please consider the attached patch.
>
> João, do you have any comments?
This is not reproducible here, but then again this isn't an
Emacs -Q recipe. What major-mode? In my *scratch* buffer, if
I type
f o o C-a " C-e "
, as Marc seems to suggest, I am left with
""foo""
as the contents, which is a balanced situation. I do not expect
to have:
"foo"
To get that, I would need to have typed " with the region active.
João
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#73688: [PATCH] electric-pair-mode - preserve balance in conservative mode
2024-10-12 20:36 ` João Távora
@ 2024-10-12 20:43 ` Marc Soda
2024-10-12 23:36 ` João Távora
0 siblings, 1 reply; 16+ messages in thread
From: Marc Soda @ 2024-10-12 20:43 UTC (permalink / raw)
To: João Távora; +Cc: Eli Zaretskii, 73688
Sorry, this is my first emacs bug report, I should have been more clear.
From emacs -Q:
(electric-pair-mode t)
(setq electric-pair-inhibit-predicate 'electric-pair-conservative-inhibit)
Evaluate those two lines and then type:
f o o C-a " C-e "
and you will be left with "foo""
Marc
On Saturday, October 12th, 2024 at 4:35 PM, João Távora <joaotavora@gmail.com> wrote:
>
>
> On Sat, Oct 12, 2024 at 1:21 PM Eli Zaretskii eliz@gnu.org wrote:
>
> > > Date: Tue, 08 Oct 2024 03:10:54 +0000
> > > From: Marc Soda marc@soda.fm
> > >
> > > When using electric-pair-mode, electric-pair-conservative-inhibit
> > > doesn't respect electric-pair-preserve-balance. For example, type out a
> > > string, go to the beginning of the line, type ", go to the end of the
> > > line, and type ". You are left with "foo"". (Exact keys from the start
> > > of a line are fooC-a"C-e", if that's more clear.) I would expect to be
> > > left with "foo" instead.
> > >
> > > This is easy to resolve in your init file (after some digging), but I
> > > think the current behavior is non-intuitive.
> > >
> > > Please consider the attached patch.
> >
> > João, do you have any comments?
>
>
> This is not reproducible here, but then again this isn't an
> Emacs -Q recipe. What major-mode? In my scratch buffer, if
> I type
>
> f o o C-a " C-e "
>
> , as Marc seems to suggest, I am left with
>
> ""foo""
>
> as the contents, which is a balanced situation. I do not expect
> to have:
>
> "foo"
>
> To get that, I would need to have typed " with the region active.
>
> João
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#73688: [PATCH] electric-pair-mode - preserve balance in conservative mode
2024-10-12 20:43 ` Marc Soda
@ 2024-10-12 23:36 ` João Távora
0 siblings, 0 replies; 16+ messages in thread
From: João Távora @ 2024-10-12 23:36 UTC (permalink / raw)
To: Marc Soda, Stefan Monnier; +Cc: Eli Zaretskii, 73688
On Sat, Oct 12, 2024 at 9:43 PM Marc Soda <marc@soda.fm> wrote:
>
> Sorry, this is my first emacs bug report, I should have been more clear.
>
> From emacs -Q:
>
> (electric-pair-mode t)
> (setq electric-pair-inhibit-predicate 'electric-pair-conservative-inhibit)
Ah, so this is the (quite) old implementation from Stefan, I think.
I didn't write or know it. I don't think it's compatible with
balance preservation.
João
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#73688: [PATCH] electric-pair-mode - preserve balance in conservative mode
2024-10-08 3:10 bug#73688: [PATCH] electric-pair-mode - preserve balance in conservative mode Marc Soda
2024-10-12 12:21 ` Eli Zaretskii
@ 2024-10-17 16:48 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-26 17:48 ` Marc Soda
1 sibling, 1 reply; 16+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-10-17 16:48 UTC (permalink / raw)
To: Marc Soda; +Cc: 73688
> When using electric-pair-mode, electric-pair-conservative-inhibit
> doesn't respect electric-pair-preserve-balance.
That's a feature.
At least that was for me the main reason to have
`electric-pair-conservative-inhibit`, i.e. so the behavior does not
depend on the global paren balance of the whole buffer (both because it
can be costly to compute and because it can be difficult to predict for
the user).
IOW, why do you use `electric-pair-conservative-inhibit` if you care
about preserving global balance?
Stefan
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#73688: [PATCH] electric-pair-mode - preserve balance in conservative mode
2024-10-17 16:48 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-10-26 17:48 ` Marc Soda
2024-10-26 18:47 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 16+ messages in thread
From: Marc Soda @ 2024-10-26 17:48 UTC (permalink / raw)
To: Stefan Monnier; +Cc: 73688
> That's a feature.
>
> IOW, why do you use `electric-pair-conservative-inhibit` if you care
> about preserving global balance?
Fair enough. To answer your question, I want the other things you have listed in `electric-pair-conservative-inhibit`. In particular, the line commented "I also find it often preferable not to pair next to a word." is very valuable to me. However, I can solve my issue pretty easily by add something like the following to my init.el:
(setq electric-pair-inhibit-predicate
;; Also inhibit if the pair would balanced
(lambda (char)
(or (electric-pair-conservative-inhibit char)
(electric-pair-inhibit-if-helps-balance char))))
The reason I submitted the patch is because is took me several years to get irritated enough to dig in and fix it for myself! :) Also, like I said above, it seemed non-intuitive. Thanks for considering, but feel free to disregard.
Are there any improvements you want made here? Only asking because I currently have the context.
Thanks,
Marc
On Thursday, October 17th, 2024 at 12:48 PM, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
>
>
> > When using electric-pair-mode, electric-pair-conservative-inhibit
>
> > doesn't respect electric-pair-preserve-balance.
>
>
> That's a feature.
> At least that was for me the main reason to have
> `electric-pair-conservative-inhibit`, i.e. so the behavior does not
> depend on the global paren balance of the whole buffer (both because it
> can be costly to compute and because it can be difficult to predict for
> the user).
>
> IOW, why do you use `electric-pair-conservative-inhibit` if you care
> about preserving global balance?
>
>
> Stefan
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#73688: [PATCH] electric-pair-mode - preserve balance in conservative mode
2024-10-26 17:48 ` Marc Soda
@ 2024-10-26 18:47 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-09 9:22 ` Eli Zaretskii
0 siblings, 1 reply; 16+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-10-26 18:47 UTC (permalink / raw)
To: Marc Soda; +Cc: 73688
>> IOW, why do you use `electric-pair-conservative-inhibit` if you care
>> about preserving global balance?
>
> Fair enough. To answer your question, I want the other things you have
> listed in `electric-pair-conservative-inhibit`. In particular, the
> line commented "I also find it often preferable not to pair next to
> a word." is very valuable to me. However, I can solve my issue pretty
> easily by adding something like the following to my init.el:
>
> (setq electric-pair-inhibit-predicate
> ;; Also inhibit if the pair would balanced
> (lambda (char)
> (or (electric-pair-conservative-inhibit char)
> (electric-pair-inhibit-if-helps-balance char))))
I see, I think you can get the same result with
(add-function :before-until electric-pair-inhibit-predicate
#'electric-pair-conservative-inhibit)
But maybe it would make sense to add a third value to
`electric-pair-preserve-balance` to get the behavior you describe.
> The reason I submitted the patch is because is took me several years
> to get irritated enough to dig in and fix it for myself! :) Also, like
> I said above, it seemed non-intuitive. Thanks for considering, but
> feel free to disregard.
Do you have an idea of how/where we could change some of the
documentation to avoid that kind of problem in the future?
Stefan
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#73688: [PATCH] electric-pair-mode - preserve balance in conservative mode
2024-10-26 18:47 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-11-09 9:22 ` Eli Zaretskii
2024-11-09 10:30 ` Nikolay Kudryavtsev
2024-11-23 17:29 ` Marc Soda
0 siblings, 2 replies; 16+ messages in thread
From: Eli Zaretskii @ 2024-11-09 9:22 UTC (permalink / raw)
To: Marc Soda, Stefan Monnier; +Cc: 73688
Ping! Marc, can you please answer Stefan's questions?
> Cc: 73688@debbugs.gnu.org
> Date: Sat, 26 Oct 2024 14:47:02 -0400
> From: Stefan Monnier via "Bug reports for GNU Emacs,
> the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
>
> >> IOW, why do you use `electric-pair-conservative-inhibit` if you care
> >> about preserving global balance?
> >
> > Fair enough. To answer your question, I want the other things you have
> > listed in `electric-pair-conservative-inhibit`. In particular, the
> > line commented "I also find it often preferable not to pair next to
> > a word." is very valuable to me. However, I can solve my issue pretty
> > easily by adding something like the following to my init.el:
> >
> > (setq electric-pair-inhibit-predicate
> > ;; Also inhibit if the pair would balanced
> > (lambda (char)
> > (or (electric-pair-conservative-inhibit char)
> > (electric-pair-inhibit-if-helps-balance char))))
>
> I see, I think you can get the same result with
>
> (add-function :before-until electric-pair-inhibit-predicate
> #'electric-pair-conservative-inhibit)
>
> But maybe it would make sense to add a third value to
> `electric-pair-preserve-balance` to get the behavior you describe.
>
> > The reason I submitted the patch is because is took me several years
> > to get irritated enough to dig in and fix it for myself! :) Also, like
> > I said above, it seemed non-intuitive. Thanks for considering, but
> > feel free to disregard.
>
> Do you have an idea of how/where we could change some of the
> documentation to avoid that kind of problem in the future?
>
>
> Stefan
>
>
>
>
>
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#73688: [PATCH] electric-pair-mode - preserve balance in conservative mode
2024-11-09 9:22 ` Eli Zaretskii
@ 2024-11-09 10:30 ` Nikolay Kudryavtsev
2024-11-09 15:55 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-23 17:29 ` Marc Soda
1 sibling, 1 reply; 16+ messages in thread
From: Nikolay Kudryavtsev @ 2024-11-09 10:30 UTC (permalink / raw)
To: Eli Zaretskii, Marc Soda, Stefan Monnier; +Cc: 73688
I'm another person interested in exactly this feature. Had a similar
rough hack in my init, though I didn't notice that
electric-pair-conservative-inhibit mostly works...
Not 100% sure about this, but I'm probably not the first person to think
that a single predicate design just does not work here in a satisfying
manner and it should be electric-pair-inhibit-predicates and then the
end user can tweak them as needed.
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#73688: [PATCH] electric-pair-mode - preserve balance in conservative mode
2024-11-09 10:30 ` Nikolay Kudryavtsev
@ 2024-11-09 15:55 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-10 14:28 ` Nikolay Kudryavtsev
0 siblings, 1 reply; 16+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-11-09 15:55 UTC (permalink / raw)
To: Nikolay Kudryavtsev; +Cc: Eli Zaretskii, Marc Soda, 73688
> Not 100% sure about this, but I'm probably not the first person to think
> that a single predicate design just does not work here in a satisfying
> manner and it should be electric-pair-inhibit-predicates and then the end
> user can tweak them as needed.
But then we'd have to hard-code whether the predicates are AND'ed or
OR'ed together. In contrast the current design lets you choosing between
`(add-function :before-until ...)` and `(add-function :before-while ...)`.
Stefan
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#73688: [PATCH] electric-pair-mode - preserve balance in conservative mode
2024-11-09 15:55 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-11-10 14:28 ` Nikolay Kudryavtsev
2024-11-23 12:22 ` Eli Zaretskii
0 siblings, 1 reply; 16+ messages in thread
From: Nikolay Kudryavtsev @ 2024-11-10 14:28 UTC (permalink / raw)
To: Stefan Monnier; +Cc: Eli Zaretskii, Marc Soda, 73688
OR seems like the natural solution for multiple predicates in this case.
And if you need AND for a subset of predicates, you can easily roll out
your own predicate implementing that.
Obviously there's nothing really wrong with add-function hacks in
practice, but, in my opinion, if we're relying on them in places for
which a proper customization ability was already designed and
implemented, it's a telling sign that it is inadequate.
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#73688: [PATCH] electric-pair-mode - preserve balance in conservative mode
2024-11-10 14:28 ` Nikolay Kudryavtsev
@ 2024-11-23 12:22 ` Eli Zaretskii
2024-11-23 17:37 ` Nikolay Kudryavtsev
0 siblings, 1 reply; 16+ messages in thread
From: Eli Zaretskii @ 2024-11-23 12:22 UTC (permalink / raw)
To: Nikolay Kudryavtsev; +Cc: 73688, marc, monnier
> From: Nikolay Kudryavtsev <nikolay.kudryavtsev@gmail.com>
> Date: Sun, 10 Nov 2024 17:28:44 +0300
> Cc: Eli Zaretskii <eliz@gnu.org>, Marc Soda <marc@soda.fm>,
> 73688@debbugs.gnu.org
>
> OR seems like the natural solution for multiple predicates in this case.
> And if you need AND for a subset of predicates, you can easily roll out
> your own predicate implementing that.
>
> Obviously there's nothing really wrong with add-function hacks in
> practice, but, in my opinion, if we're relying on them in places for
> which a proper customization ability was already designed and
> implemented, it's a telling sign that it is inadequate.
Is there anything else to do in this bug, or should we now close it?
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#73688: [PATCH] electric-pair-mode - preserve balance in conservative mode
2024-11-23 12:22 ` Eli Zaretskii
@ 2024-11-23 17:37 ` Nikolay Kudryavtsev
0 siblings, 0 replies; 16+ messages in thread
From: Nikolay Kudryavtsev @ 2024-11-23 17:37 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 73688, marc, monnier, João Távora
Yes, I think before closing, we need João, or someone else on the dev
team to judge on the merit of the multiple ORd
electric-pair-inhibit-predicates idea.
Implementing it would lead to deprecating
electric-pair-inhibit-predicate(should be still working though for X
major versions), and beyond this use-case there doesn't seem to be that
many other use cases for inhibit-predicates anyway. But this would give
us a lot more flexibility for whenever they appear, since this seems to
be the proper solution here.
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#73688: [PATCH] electric-pair-mode - preserve balance in conservative mode
2024-11-09 9:22 ` Eli Zaretskii
2024-11-09 10:30 ` Nikolay Kudryavtsev
@ 2024-11-23 17:29 ` Marc Soda
1 sibling, 0 replies; 16+ messages in thread
From: Marc Soda @ 2024-11-23 17:29 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 73688, Stefan Monnier
> Do you have an idea of how/where we could change some of the
> documentation to avoid that kind of problem in the future?
Sorry for the silence here, I've been unusually busy for the few weeks.
Multiple OR'd predicates predicates makes sense to me. I'd be willing to work on that if there's interest.
As for documentation, I'm not really sure. I couldn't find anything referencing electric-pair-inhibit-predicate in the manual. Should probably added to https://www.gnu.org/software/emacs/manual/html_node/emacs/Matching.html.
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2024-11-23 17:37 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-08 3:10 bug#73688: [PATCH] electric-pair-mode - preserve balance in conservative mode Marc Soda
2024-10-12 12:21 ` Eli Zaretskii
2024-10-12 19:47 ` Marc Soda
2024-10-12 20:36 ` João Távora
2024-10-12 20:43 ` Marc Soda
2024-10-12 23:36 ` João Távora
2024-10-17 16:48 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-26 17:48 ` Marc Soda
2024-10-26 18:47 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-09 9:22 ` Eli Zaretskii
2024-11-09 10:30 ` Nikolay Kudryavtsev
2024-11-09 15:55 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-10 14:28 ` Nikolay Kudryavtsev
2024-11-23 12:22 ` Eli Zaretskii
2024-11-23 17:37 ` Nikolay Kudryavtsev
2024-11-23 17:29 ` Marc Soda
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
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).