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#72437: Unexpected behavior when inserting with prefix arg in electric-pair-mode Date: Sat, 03 Aug 2024 12:12:06 +0300 Message-ID: <86h6c2ug0p.fsf@gnu.org> References: <87le1edqqm.fsf@breatheoutbreathe.in> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10147"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 72437@debbugs.gnu.org To: Joseph Turner , Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Aug 03 11:12:57 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 1saAor-0002T1-AH for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 03 Aug 2024 11:12:57 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1saAog-0002Z3-Uz; Sat, 03 Aug 2024 05:12:47 -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 1saAoe-0002Ya-8j for bug-gnu-emacs@gnu.org; Sat, 03 Aug 2024 05:12:44 -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 1saAod-0002HL-UX for bug-gnu-emacs@gnu.org; Sat, 03 Aug 2024 05:12:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=References:In-Reply-To:From:Date:To:Subject; bh=MDAjoUKdz9k5FARzGIFs22rLS32Nu2Non5O0GlrJcX4=; b=RZ7qfYwGbloWnH1RB65UEEEgER9d5DQ2Y0tIugSDmSLBfvcZKzakLJLUKQBe01oNxNRpwbDY8s3w8ngtnVUMeOPgeHbq4BN1LD1CN4QFSSyFuC5stP8ka2ol5pJA1hH5n8Bm4YdG6mUOAtzwHPxM/vkzJIMSYrWKKNCaINZT6YnGwJNrsm/fa4E23bjinEcsqI5YpANb2EubmstPLjLt90qyFE1KtGIr3Zcp7QeqvMcJaNhqNVmVh3Dqt/V8AaRDjTVfFf5JkkN9j3mnRyhpKKa05UCbp9TzZ94yUycsa61s7zXplOCobrteS/JWLPz59FpERYvrIfM5a2KcVYDlYg==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1saAow-0006qt-1T for bug-gnu-emacs@gnu.org; Sat, 03 Aug 2024 05:13: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: Sat, 03 Aug 2024 09:13:02 +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.172267636026304 (code B ref 72437); Sat, 03 Aug 2024 09:13:02 +0000 Original-Received: (at 72437) by debbugs.gnu.org; 3 Aug 2024 09:12:40 +0000 Original-Received: from localhost ([127.0.0.1]:54078 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1saAoZ-0006qC-MP for submit@debbugs.gnu.org; Sat, 03 Aug 2024 05:12:40 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:36264) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1saAoW-0006px-59 for 72437@debbugs.gnu.org; Sat, 03 Aug 2024 05:12:37 -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 1saAo6-0002EU-Sr; Sat, 03 Aug 2024 05:12:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=MDAjoUKdz9k5FARzGIFs22rLS32Nu2Non5O0GlrJcX4=; b=CIQXcDzvf1ss vnQPwU/VnGZunyE6OGY9+Z505HXlPJeJm4BHrloeEk7TpUN5iX5WlqY66LhylgIS0yV5AzpWz44wk /mekndjO2KDeuAZ440+f8XE2YSXOwEphR+YmbEN4gD6tEcxWSwYhvsW4TGkN2Rw+QyGnzVPZZLbcW U3SsX//+sB4pkOABriuqAZHqmMRBkmrLrLVRV1kaoW9YTuIJWg6KVPfwQ2JbCnQ29EKWOCCZhH2BN NrLcLp3jIshJV3rKIZffMTGOhqiDuri8AYP7E4c/1CvpHiyi8cV2FZIHKOSeVAovmE+SLaAJ6bcU/ mRAzBJs88gboj89HW+E93w==; In-Reply-To: <87le1edqqm.fsf@breatheoutbreathe.in> (message from Joseph Turner on Sat, 03 Aug 2024 00:12:33 -0700) 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:289669 Archived-At: > Cc: eliz@gnu.org > From: Joseph Turner > Date: Sat, 03 Aug 2024 00:12:33 -0700 > > Migrated from this thread on the devel mailing list: > > https://yhetil.org/emacs-devel/86ikwiumza.fsf@gnu.org/T/#t > > > On Emacs 29.4, with emacs -Q > > Turn on electric-pair-mode > > (electric-pair-mode +1) > > Then press "C-2 (" > > Expected result: > > Either (()) or ()() > > Actual result: > > (() > > > I noticed the unexpected behavior when attempting to surround some text > with multiple braces in order to create Anki flashcards. > > 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. > > 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?