From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#71337: 30.0.50; `electric-pair-mode' and custom keybinding Date: Tue, 04 Jun 2024 14:04:15 +0300 Message-ID: <5687F977-A3BC-4D44-9A94-068E2679275C@gnu.org> References: <87frtu9lts.fsf@gmx.net> <877cf52mib.fsf@gmx.net> <81C90874-2077-4358-A611-BDC94B98287E@gnu.org> <87ikyp10l6.fsf@gmx.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23966"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: K-9 Mail for Android Cc: arash@gnu.org, 71337@debbugs.gnu.org, joaotavora@gmail.com, monnier@iro.umontreal.ca To: Stephen Berman Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jun 04 13:23:20 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sESG7-00061e-VL for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 04 Jun 2024 13:23:20 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sESFe-0002uL-Hn; Tue, 04 Jun 2024 07:22:50 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sESFd-0002ts-E8 for bug-gnu-emacs@gnu.org; Tue, 04 Jun 2024 07:22:49 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sESFd-0003T7-60 for bug-gnu-emacs@gnu.org; Tue, 04 Jun 2024 07:22:49 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sESFq-0001qK-G1 for bug-gnu-emacs@gnu.org; Tue, 04 Jun 2024 07:23:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 04 Jun 2024 11:23:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71337 X-GNU-PR-Package: emacs X-Debbugs-Original-Cc: Arash Esbati , bug-gnu-emacs@gnu.org, 71337@debbugs.gnu.org, =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= , Stefan Monnier Original-Received: via spool by submit@debbugs.gnu.org id=B.17175001456919 (code B ref -1); Tue, 04 Jun 2024 11:23:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 4 Jun 2024 11:22:25 +0000 Original-Received: from localhost ([127.0.0.1]:40658 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sESFE-0001nS-Vz for submit@debbugs.gnu.org; Tue, 04 Jun 2024 07:22:25 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:43296) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sESFD-0001n7-6Q for submit@debbugs.gnu.org; Tue, 04 Jun 2024 07:22:24 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sERxm-0006Ec-Do for bug-gnu-emacs@gnu.org; Tue, 04 Jun 2024 07:04:22 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sERxl-0003hr-La; Tue, 04 Jun 2024 07:04:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Subject:To:From: Date; bh=R/d+RIqz4/VAex6g0V7vRlAg0K8Siny/bxsRrGGtSNA=; b=C2o0KtBhSDLZkwd4NRLJ Ttbm61fwR7A3AtzH2Ptupthavagyis6WpFMtBm7GoLW6g+69lhr32gR+KltlrM+le0lXSKnrK+gKM 2gWQpjv6TuZKq7ir4QEe1e3/+M0IWEGytyKUwdv7M2RCWe1ClmBhsZA7Htd3HRzRqxQ5S1buN7FQg +1A9UmGyCSdmkGam3yHmPxB9c4SNvvJrmgdmrGDSDtKJ0Xwzhbkv028Gzqdl9YTuhvTvwp2R7wDTj KWjV68tr1KfNqLpZ3xQhgbXrR9l6fDFSQpsBv0YhIJioUYQDFErpGy4Xinuv4zNi1L5t50t89rrjc hM23iMKtL7uFKg==; In-Reply-To: <87ikyp10l6.fsf@gmx.net> Autocrypt: addr=eliz@gnu.org; keydata= mQENBF+pf4UBCAC6vjkWLSAsQpe8YIGKLQzNOJx/IjGtCdFF8uzmO5jmME+SD8ROuJN+t5KXVw58 uzu75EFD0vHTY9e+udJ2gkpuy0NnzkFcbumdLLo2ERKCoSctZZRhzKXI5z5cHxCqW0B2ygHRrRLt oNlGID7bAgcgSViT1ptGqTXO7zGVu4Airok7dNzcPtHgns8GlR5YAFX0TvE6oGd0l2VPghNeVJKJ OjrbfhoDxl3ucFpqbqMH8z9HTLDOFpz8UaYYUdJMi3xX6vwTZxI2sM2RRVLUpZyllAkSMI4lln1O OgazM/62DJUs/rKIHKBnF6h3/qsJUjUYXaAHbrXY26mWllAd536lABEBAAG0I0VsaSBaYXJldHNr aWkgKGVsaXopIDxlbGl6QGdudS5vcmc+iQE4BBMBAgAiBQJfqX+FAhsDBgsJCAcDAgYVCAIJCgsE FgIDAQIeAQIXgAAKCRCRwSYvAeuNOYUQB/4/iIKKOG45ijNaRoTvmJJZMvj1S07WQxEm7c5SHEeE QbLOAxB9vESOV7sLueuN3oqEndtzyYt4x1WTSBmHFF7h5fcCMjBs41siOIp5Sj/xD0Bvaa0IKGCR SZ7PAo8Mq3wgajXpTpn9vxE2PmtzA8KdEE0K1+f9pVAfOpUIcCl44rIxLUW352XG0y7iz6c/O6LB 1deOKMiKFctKO7pBti1dJEm1ImewLH3H8uTbwspLOs3EB8xhsESxmTidnze68HX2jt+2EeMgCdki NU+LWbexQZPfIS7+ZmE06ll0v6+Jy7ZdTkCCRypKWTnW7pIFsq/p4kybV8O/kHSV6B4vvQBfuQEN BF X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:286532 Archived-At: On June 4, 2024 1:09:09 PM GMT+03:00, Stephen Berman wrote: > On Tue, 04 Jun 2024 12:24:59 +0300 Eli Zaretskii wrote: >=20 > > On June 4, 2024 11:08:51 AM GMT+03:00, "Jo=C3=A3o T=C3=A1vora" wrote: > >> On Tue, Jun 4, 2024 at 8:37=E2=80=AFAM Jo=C3=A3o T=C3=A1vora wrote: > >>=20 > >> I've had a look=2E it looks like the problems is e-p-mode's assumpti= on > >> that last-command-event is the thing to be inserted=2E The fact that > >> it isn't here (somehow an innocent 92 is now a monstrous 8388643), > >> triggers the problem (8388643 isn't a representation of a character, > >> apparently)=2E > >>=20 > >> But according to the docstring of post-self-insert-hook, > >> the assumption seems sane, and I probably coded for it=2E > >>=20 > >> post-self-insert-hook is a variable defined in `src/cmds=2Ec'=2E > >>=20 > >> =2E=2E=2E > >>=20 > >> The hook can access the inserted character via `last-command-event'= =2E > >> =2E=2E=2E > >>=20 > >> I don't think the patch is fully correct=2E I think Stefan is the ri= ght > >> person to call here=2E I've had an even briefer look at cmds=2Ec and= I > >> don't understand how that hook's promise is honoured=2E > > > > > > It looks like Arash made the mistake of being the first one, ever, of = invoking > > self-insert-command from Lisp with 2nd arg non-nil, and turning on > > electric-pair-mode on top of that=2E When self-insert-command is call= ed with 2 > > args, it uses the 2nd arg as the character to insert, but it does NOT > > overwrite last-command-event with that character=2E So post-self-inse= rt-hook > > sees the wrong event and rightfully barfs=2E > > > > Which means the patch proposed by Stephen is not TRT, because it means > > electric-pair-mode will ignore the inserted backslashes=2E >=20 > My patch should only make electric-pair-mode ignore key sequences which > don't satisfy characterp, e=2Eg=2E "s-#" or "C-#"=2E I just tested my p= atch > after giving ?\ open parenthesis syntax, binding it to "C-#" and > enabling electric-pair-mode, and what I see is that typing `C-#' inserts > a "\" while typing `\' insert "\\"=2E Is this not the desired behavior? > (Of course, that doesn't means a lower-level change isn't preferable=2E) >=20 > Steve Berman >=20 >=20 My point is that if a character is inserted by Arash's command, your patch= might ignore it, depending on the command's binding=2E