From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stephen Berman via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#71337: 30.0.50; `electric-pair-mode' and custom keybinding Date: Tue, 04 Jun 2024 12:09:09 +0200 Message-ID: <87ikyp10l6.fsf@gmx.net> References: <87frtu9lts.fsf@gmx.net> <877cf52mib.fsf@gmx.net> <81C90874-2077-4358-A611-BDC94B98287E@gnu.org> Reply-To: Stephen Berman 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="4109"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: arash@gnu.org, 71337@debbugs.gnu.org, joaotavora@gmail.com, monnier@iro.umontreal.ca To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jun 04 12:10:19 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 1sER7S-0000t9-Q5 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 04 Jun 2024 12:10:18 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sER71-0004d8-0W; Tue, 04 Jun 2024 06:09:51 -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 1sER6z-0004cG-CR for bug-gnu-emacs@gnu.org; Tue, 04 Jun 2024 06:09: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 1sER6z-000736-3y for bug-gnu-emacs@gnu.org; Tue, 04 Jun 2024 06:09:49 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sER7C-0006xe-Ax for bug-gnu-emacs@gnu.org; Tue, 04 Jun 2024 06:10:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stephen Berman Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 04 Jun 2024 10:10: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.171749579926744 (code B ref -1); Tue, 04 Jun 2024 10:10:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 4 Jun 2024 10:09:59 +0000 Original-Received: from localhost ([127.0.0.1]:35504 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sER79-0006xG-4i for submit@debbugs.gnu.org; Tue, 04 Jun 2024 06:09:59 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:46236) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sER77-0006x6-FZ for submit@debbugs.gnu.org; Tue, 04 Jun 2024 06:09:58 -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 1sER6t-0004bO-J9 for bug-gnu-emacs@gnu.org; Tue, 04 Jun 2024 06:09:43 -0400 Original-Received: from mout.gmx.net ([212.227.15.19]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sER6r-0006zp-7a; Tue, 04 Jun 2024 06:09:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.net; s=s31663417; t=1717495767; x=1718100567; i=stephen.berman@gmx.net; bh=zrwH0bq17BVdOe7CIu1/X3nnhnb47nbz02Hq5oilTfA=; h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date: Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=Di0uwb7oBpcIJgrhnWjVicxnu4qp1EJckr6VCyZs2vuLZ7uQ/20bjfu+1elOVwcR lBW69vLA1elIg+E+ydKlQY1qXC9d82q9QCB4NyDcAoSR/0XcLqnP0VUGrouBgEZHF xy6pOnvz7cuOcZlCy/GBOLAaEVrMFZ3qBDfNHBkxWIL2M1JLGpZX3JgUHyErswXxJ w82brlgv1mKmkKGr8EsQiLHnq3XTw/zAn43ZusmT4XzbQYJV2JRTd6CVWKL210t9I MnUNsEPVWWAwRV235ONFv/EgMFrhfgF4ZRguHFMD4Yfjwsg8ujJPw4ydcjQXXv9/q wCKsgH0sjLORAG9Lqw== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Original-Received: from strobelfs ([94.134.94.117]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1My32L-1sNs6q37eh-00zWn8; Tue, 04 Jun 2024 12:09:27 +0200 In-Reply-To: <81C90874-2077-4358-A611-BDC94B98287E@gnu.org> (Eli Zaretskii's message of "Tue, 04 Jun 2024 12:24:59 +0300") X-Provags-ID: V03:K1:L9qohXdsa+kffOUh8w6SU5Nnu6o/EILFoi9CZuL4XYlzAbYzDSk 5mPi08h5PJgEB4Vh4oRWRyXoQPDAhALilGjXExq90VcwfK/8GPAbYVpRUN2TbLQiwHSojQH b0cSG6kJV2s1iEOB42exHLmKtzigz7ZPaB0ba3PJm/NibfU82Uu9viK7TZDI0KJ4rBnwE/X i1thLU4aJRoTXsHFk5Riw== UI-OutboundReport: notjunk:1;M01:P0:UNUlS2vY4vs=;uocvVtSn2c6FwVS05nCBxNwF3YO lmDBKND7WeKib4YLspFC1uj3r8SPsTHoA+/CJBEXmwAujmmZvzLMWSjPcRPNLtfXj8qqAt9/X ACFW7fr1MPrufrkWEJwbWWEkAMTJG5AKcZjRlNwFIv+wCfu6O67JzWaQOcVq+QFTdJBphoSDe r8iOZtCkLYJmb4AZHrRT6hkorJMh13sK20Pr4R6Jn0tdQ5duiE9V78nWu6exL6zJlAO4w4QPo u6FQL7pYjcu1IL/UeXDYB+TjX/1hfPxm1ozHuhO6pBtKK3CYV37jldfkMo9FYdYgyNr6ZHeXD ZVCrVXhqXjQ8akbGOcArMFj2Ed4xCIi1EimwnGlAx3JmXbbAwUoUCG3SmJCIAHmOVkslJLbIQ ocT+FuOrbRxRAsRQ9+47ZWK4dU5vx4l/JDymLdyZG1lZULlZo2cTqhRO48umRPP3VNas03CWo XVzf09jn1oJwe9LeVAW2a7iO8WE6odTRQ708wkM3rxWpQpUW1uvXMQDHlsvxIaalzPzsSXdyO Ya0xUSTADOBFqpQozASDrd8iS1wxmWi5yp3VLEpfMJ/ymQQyRQW6YFywVwlzTLZc4p+PSe+Yh dSkDHSuk0N+T3r0H8VQBHPOGvgF5qwewb8KaGsUBRE+Jonlc/tjqcm8LEHcKg/2j2F559criJ Uxp0jXl9Pybxnw2XT1Mar85iMdHRd0dfh7haodsKsshSyb6HkzCr7qsM9d3V9FeWHpwuhozCm NRkDZ1fnGMOsfPhuwEM3Pe4cBawPmxuaCPoDh9dUmT16mQpa3O3TsFer9ptcDUuOeC86j/Ac Received-SPF: pass client-ip=212.227.15.19; envelope-from=stephen.berman@gmx.net; helo=mout.gmx.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action 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:286529 Archived-At: On Tue, 04 Jun 2024 12:24:59 +0300 Eli Zaretskii wrote: > 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. it looks like the problems is e-p-mode's assumption >> that last-command-event is the thing to be inserted. 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). >>=20 >> But according to the docstring of post-self-insert-hook, >> the assumption seems sane, and I probably coded for it. >>=20 >> post-self-insert-hook is a variable defined in `src/cmds.c'. >>=20 >> ... >>=20 >> The hook can access the inserted character via `last-command-event'. >> ... >>=20 >> I don't think the patch is fully correct. I think Stefan is the right >> person to call here. I've had an even briefer look at cmds.c and I >> don't understand how that hook's promise is honoured. > > > It looks like Arash made the mistake of being the first one, ever, of inv= oking > self-insert-command from Lisp with 2nd arg non-nil, and turning on > electric-pair-mode on top of that. When self-insert-command is called wi= th 2 > args, it uses the 2nd arg as the character to insert, but it does NOT > overwrite last-command-event with that character. So post-self-insert-ho= ok > sees the wrong event and rightfully barfs. > > Which means the patch proposed by Stephen is not TRT, because it means > electric-pair-mode will ignore the inserted backslashes. My patch should only make electric-pair-mode ignore key sequences which don't satisfy characterp, e.g. "s-#" or "C-#". I just tested my patch 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 "\\". Is this not the desired behavior? (Of course, that doesn't means a lower-level change isn't preferable.) Steve Berman