bug#50236: 27.2; electric-pair-mode is inconvenient in comint

João Távora <[email protected]> Fri, 07 Aug 2026 19:34:12 +0100
Newsgroups gmane.emacs.bugs
Message-ID <[email protected]>
Augusto Stoffel <[email protected]> writes:

>> If org-mode is using "text fields", why doesn't it just use text
>> fields? :) i.e if using
>> something akin to fields, why doesn't it used the proper text properties to help
>> interoperate with other parts of Emacs? That's the Emacs way afaik.
>
> I'm just observing a fact; the text property tracking code blocks in Org
> and Markdown mode is called something different from 'field'.  I'm
> certainly not going to argue those mode authors did it wrong.

It's not a question of "doing it wrong", it a question of using start
using the property 'field' unless they have an extremely good reason not
to.  If they do that they will help e-p-m to work nicely with them by
default (just like filling in a syntax table is another optional but
useful thing to do.  Which reminds me gotta tell markdown-ts-mode devs
to set backquote in their syntax...).

> Isn't the Emacs way to provide suitable customization hooks?

You mean bloating itself with multiple complex knobs and multiple
additional less generic ways to solve a problem?  :-) Yes,
unfortunately true in many cases, but I'm not a fan.

> In fact, experience shows that variables like electric-pair-skip-self
> and electric-pair-skip-whitespace over time "graduate" to accept a
> function value, because those hooks end up being necessary somehow.

e-p-s-s is already a function, so I don't understand your request.  You
can definitely use it, but I happen to think it's not the elegant way to
fix it: the electric-pair-skip-self et al were written by me in 2014 and
I only made them functions to to keep the previous e-p-m behavior that
nobody remembers because it wasn't spectacular and didn't do any
balancing and to help with real tricky stuff like the triple quotes in
Python.  More importantly I re-wrote e-p-m from scratch to take
advantage of something that is structurally there in most major modes as
an Emacs staple -- syntax tables.  I was very successful allowing the
minor mode to work semamlessly across 99% of major modes without any
mode-specific code or intrusion into the major mode.  Only small
exceptions (Pyton and Latex come to mind).

One clever think I _didn't_ do is remember another structural staple of
Emacs: field properties, and how these could be used similarly to guide
e-p-m in modes such as comint (and its many derivees) eww, erc, custom
widgets, erc etc.  Andrew has now thought of that, I think it's quite in
line with the e-p-m near-0-intrusion principle and quite effective.  But
that is only my opinion.

João