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

Augusto Stoffel <[email protected]> Fri, 07 Aug 2026 08:36:29 +0200
Newsgroups gmane.emacs.bugs
Message-ID <[email protected]>
On Thu,  6 Aug 2026, João Távora wrote:

> Andrew Hyatt <[email protected]> writes:
>
>>  If so, it'll be much easier to review and to understand by future maintainers. 
>>
>> Yes, I can create a macro that does the restriction, which may help
>> readability. I've done so in a new patch which is now
>> attached.
>
> - The value of 1000 could be suitable, but you have to be aware this
>   will amount to two new buffer field searches for _every_ insertion in
>   the buffer, not just parenthesis.  This is probably "peanuts",
>   i.e. not relevant, but you should find some way to measure.  Like how
>   many spaces can you type in one minute if you hold down the spacebar
>   in an emacs -Q -f electric-pair-mode before&after your change?

This is my opinion another reason to make the computation of bounds a
customizable function (i.e. a defvar-local with function value).

That way we can enable the field search only in comint-mode, while at
the same time allowing org-mode, markdown-mode et al. to solve the
analogous bug much more simply.

The current implementation would force those modes to add redundant
fields properties to the buffer, while a suitable text property
indicating a "text field" (such as src-block in Org's mode) is already
present.