GNU bug report logs - #79047
Add some multi-character pairs to some major modes.

Previous Next

Package: emacs;

Reported by: Elijah Gabe Pérez <eg642616 <at> gmail.com>

Date: Sat, 19 Jul 2025 02:05:02 UTC

Severity: normal

Done: Eli Zaretskii <eliz <at> gnu.org>

Full log


View this message in rfc822 format

From: Alan Mackenzie <acm <at> muc.de>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 79047 <at> debbugs.gnu.org, acm <at> muc.de, eg642616 <at> gmail.com, jm <at> pub.pink, monnier <at> iro.umontreal.ca
Subject: bug#79047: Add some multi-character pairs to some major modes.
Date: Fri, 25 Jul 2025 11:42:37 +0000
Hello, Eli.

On Fri, Jul 25, 2025 at 14:08:43 +0300, Eli Zaretskii wrote:
> > Date: Fri, 25 Jul 2025 10:32:15 +0000
> > Cc: monnier <at> iro.umontreal.ca, eg642616 <at> gmail.com, 79047 <at> debbugs.gnu.org,
> >   jm <at> pub.pink, acm <at> muc.de
> > From: Alan Mackenzie <acm <at> muc.de>

> > > And as I already mention, you perceive a convention where there is
> > > none.

> > OK, then, Emacs hackers have abided by this non-convention nevertheless,
> > out of instinctive good sense and good taste.  Up until
> > post-self-insert-hook.

> Which might mean there was no non-convention to begin with.

> > > Thus electric-pair-mode doesn't violate any conventions.

> > self-insert-command, called from Lisp, is broken.  There is no usable
> > definition of its functionality.

> What's wrong with its doc string as that definition?

It's inaccurate and misleading.

We have:

    Insert the character you type.
    Whichever character C you type to run this command is inserted.
    [Plus all the bits about the numeric prefix, abbreviations, etc.]

More accurate would be:

    Maybe insert the character you type (depending on
    post-self-insert-hook).
    Insert or delete further characters as specified by
    post-self-insert-hook.
    Leave point at the position determined by post-self-insert-hook or
    after the inserted character.

..  This makes it unusable in a Lisp program.  For example, in
c-electric-paren, which handles the user entering "(" or ")", the code
needs to determine whether the "(" was entered at the end of a line.
The current self-insert-command, which inserts arbitrary further
characters, makes this difficult.

With the current self-insert-command, there is no satisfactory way of
coding c-electric-paren - only workarounds with varying degrees of
ugliness.

I am suggesting that self-insert-command should be made usable from Lisp
again, as it once was, and have suggested a means for achieving this.

-- 
Alan Mackenzie (Nuremberg, Germany).




This bug report was last modified 1 day ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.