bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#71337: 30.0.50; `electric-pair-mode' and custom keybinding


From: Stephen Berman
Subject: bug#71337: 30.0.50; `electric-pair-mode' and custom keybinding
Date: Mon, 03 Jun 2024 15:50:55 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

On Mon, 03 Jun 2024 14:40:47 +0200 Arash Esbati <arash@gnu.org> wrote:

> Hi all,
>
> I have a custom keybinding "s-ß" with my German keyboard, but the issue
> I'm facing is also reproducible like this:
>
> • emacs -Q
> • In scratch, eval:
>
>   (progn
>     (setq debug-on-error t)
>     (electric-pair-mode  1)
>     (keymap-global-set "s-#" (lambda (arg)
>                                "Insert ARG backslash(es)."
>                                (interactive "*p")
>                                (self-insert-command arg ?\\))))
>
> • Now hit "s-#" and the debugger says (linebreaks added manually):
>
> Debugger entered--Lisp error: (wrong-type-argument characterp 8388643)
>   #f(compiled-function () #<bytecode -0x15954a2c5d74b890>)()
>   electric-pair--with-syntax-1(nil #f(compiled-function () #<bytecode 
> -0x15954a2c5d74b890>))
>   electric-pair-syntax-info(8388643)
>   electric-pair-post-self-insert-function()
>   self-insert-command(1 92)
>   #f(lambda (arg) [t] "Insert ARG backslash(es)." (interactive "*p")
>    (self-insert-command arg 92))(1)
>   funcall-interactively(#f(lambda (arg) [t] "Insert ARG backslash(es)."
>    (interactive "*p") (self-insert-command arg 92)) 1)
>   command-execute(#f(lambda (arg) [t] "Insert ARG backslash(es)."
>    (interactive "*p") (self-insert-command arg 92)))
>
> Running the exercise with (electric-pair-mode -1) doesn't throw an
> error.

If the pairing in electric-pair-mode should only be triggered by
self-inserting characters (as the current code seems to require), then
the attached patch appears to avoid the above problem.

Steve Berman

Attachment: txtuyBtn0zAyO.txt
Description: electric-pair-post-self-insert-function patch


reply via email to

[Prev in Thread] Current Thread [Next in Thread]