From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#72437: Unexpected behavior when inserting with prefix arg in electric-pair-mode Date: Tue, 13 Aug 2024 20:57:44 -0400 Message-ID: References: <87le1edqqm.fsf@breatheoutbreathe.in> <86h6c2ug0p.fsf@gnu.org> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5811"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 72437@debbugs.gnu.org, Joseph Turner To: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Aug 14 02:58:48 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 1se2Lf-0001Mf-Gu for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 14 Aug 2024 02:58:48 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1se2LO-0008D0-W7; Tue, 13 Aug 2024 20:58:31 -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 1se2LM-0008CY-4p for bug-gnu-emacs@gnu.org; Tue, 13 Aug 2024 20:58:28 -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 1se2LL-0004Mb-SF for bug-gnu-emacs@gnu.org; Tue, 13 Aug 2024 20:58:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=19iAvhF8/y3+O84kXKJEfyBfBZrzkrTQUbv/GBpb5f0=; b=pwa44L9oSHZ1jE6l2/x9bqQNB/1kzeBr25gnJwVLrLrl7bce3HbRoR1vDEhewO3kZXBgOoxekcGeRcwVDAD8htPrzg8gG+9bILV2oXsmnNifmLnOvXYSPVvnMEuAbibcuHdcU6xnNqBjnh7YlF7PkwR/dqXJXtHs0Ayrk/DI0ukHYSfjlScLBjSejfzwWsbrrYbvjGOAIemS5RolXBrpVlGJpiUpUIDz9Fo13/j/zH9B4gg7R6TH9p0UMmsOCmMjofuWlwhYDUZFssC72fSVKyNxRpPvxiKFfKuacnUMn+H1ldVoaLspyEPRUo+EwaBxTSYeLaKWX2gQCNuOMmdp4g==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1se2Lt-0000fQ-Kg for bug-gnu-emacs@gnu.org; Tue, 13 Aug 2024 20:59:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 14 Aug 2024 00:59:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72437 X-GNU-PR-Package: emacs Original-Received: via spool by 72437-submit@debbugs.gnu.org id=B72437.17235971132500 (code B ref 72437); Wed, 14 Aug 2024 00:59:01 +0000 Original-Received: (at 72437) by debbugs.gnu.org; 14 Aug 2024 00:58:33 +0000 Original-Received: from localhost ([127.0.0.1]:45742 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1se2LQ-0000eF-Ui for submit@debbugs.gnu.org; Tue, 13 Aug 2024 20:58:33 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:64211) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1se2LP-0000e1-8q for 72437@debbugs.gnu.org; Tue, 13 Aug 2024 20:58:32 -0400 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id B98D4100061; Tue, 13 Aug 2024 20:57:51 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1723597070; bh=WnMYu9OH4qUAA7KFIpnP4eZfZq2U6DGp1xWKXajXS7Q=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=XMPgpGRPXAxAUV7JaLGOFFkT4ytwuutVH9/VdWqWpp1tq8wgAAGwu6WUOBYiL12Wo BGngREeHzxtBidqAqHMoauwkFlfweoZz/km9n6drs6RmS9BtJwwXqOjaGcD6YW+8Hh Kg6RWy4duoBzIooIZmdFNjWNvAfS9NGGPwUEYbhA/t+nH9iH7B1n/NGscEhO5SXrTP 4/3YVw0ixjLWQVEPeynZRDpJ2+Nr63H9FYCCF6wq5Gg+Yg+CLSDQoQJg3ti85JVSiM sHx5d2p8f+wGw4DSg+orlhHg8FYSuGouS4xxXCuIw0QM1fnH5KOCj9PVuLpbsM4Dw0 Tl/hqv/p1DMOQ== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 33D8910002E; Tue, 13 Aug 2024 20:57:50 -0400 (EDT) Original-Received: from pastel (unknown [216.154.9.87]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 06A481201A6; Tue, 13 Aug 2024 20:57:50 -0400 (EDT) In-Reply-To: <86h6c2ug0p.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 03 Aug 2024 12:12:06 +0300") 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:290103 Archived-At: Hi Jo=E3o, Do you have a good idea of how to make C-M-SPC C-2 { wrap the selected word within two braces? Stefan Eli Zaretskii [2024-08-03 12:12:06] wrote: >> Cc: eliz@gnu.org >> From: Joseph Turner >> Date: Sat, 03 Aug 2024 00:12:33 -0700 >>=20 >> Migrated from this thread on the devel mailing list: >>=20 >> https://yhetil.org/emacs-devel/86ikwiumza.fsf@gnu.org/T/#t >>=20 >>=20 >> On Emacs 29.4, with emacs -Q >>=20 >> Turn on electric-pair-mode >>=20 >> (electric-pair-mode +1) >>=20 >> Then press "C-2 (" >>=20 >> Expected result: >>=20 >> Either (()) or ()() >>=20 >> Actual result: >>=20 >> (() >>=20 >>=20 >> I noticed the unexpected behavior when attempting to surround some text >> with multiple braces in order to create Anki flashcards. >>=20 >> More or less, I wanted to go from "foo" to "{{foo}}", and I thought >> perhaps that with the whole word selected, pressing "C-2 {" would DTRT. >>=20 >> In general, I'm not sure whether "{}{}" or "{{}}"is more useful or >> expected, but I suspect both are better than "{{}". > > Making it produce "{}{}" is relatively easy: we just need to call the > post-self-insert-hook for each of the ARG inserted characters. OTOH, > to produce "{{}}" we'd probably need to rewrite the > electric-pair-mode's hook function, but I have no idea how to rewrite > it to do that. > > Stefan, any suggestions?