[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#73688: [PATCH] electric-pair-mode - preserve balance in conservative
From: |
Eli Zaretskii |
Subject: |
bug#73688: [PATCH] electric-pair-mode - preserve balance in conservative mode |
Date: |
Sat, 09 Nov 2024 11:22:48 +0200 |
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
>
>
>
>
>
- bug#73688: [PATCH] electric-pair-mode - preserve balance in conservative mode,
Eli Zaretskii <=
- bug#73688: [PATCH] electric-pair-mode - preserve balance in conservative mode, Nikolay Kudryavtsev, 2024/11/09
- bug#73688: [PATCH] electric-pair-mode - preserve balance in conservative mode, Stefan Monnier, 2024/11/09
- bug#73688: [PATCH] electric-pair-mode - preserve balance in conservative mode, Nikolay Kudryavtsev, 2024/11/10
- bug#73688: [PATCH] electric-pair-mode - preserve balance in conservative mode, Eli Zaretskii, 2024/11/23
- bug#73688: [PATCH] electric-pair-mode - preserve balance in conservative mode, Nikolay Kudryavtsev, 2024/11/23
- bug#73688: [PATCH] electric-pair-mode - preserve balance in conservative mode, Eli Zaretskii, 2024/11/30
- bug#73688: [PATCH] electric-pair-mode - preserve balance in conservative mode, João Távora, 2024/11/30
bug#73688: [PATCH] electric-pair-mode - preserve balance in conservative mode, Marc Soda, 2024/11/23