From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Joseph Turner 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: Sat, 21 Sep 2024 10:24:57 -0700 Message-ID: <87o74gsyvq.fsf@breatheoutbreathe.in> References: <87le1edqqm.fsf@breatheoutbreathe.in> <86h6c2ug0p.fsf@gnu.org> <86a5htvclm.fsf@gnu.org> <86zfpttpfl.fsf@gnu.org> <20F64DCD-929F-4B4C-BF85-ABE26FC7C995@breatheoutbreathe.in> <87plp0w7g7.fsf@breatheoutbreathe.in> Reply-To: Joseph Turner Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29263"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 72437@debbugs.gnu.org, eliz@gnu.org, monnier@iro.umontreal.ca To: Eshel Yaron Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Sep 21 19:26:07 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 1ss3rz-0007OS-Aa for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 21 Sep 2024 19:26:07 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ss3rc-0001Gz-Np; Sat, 21 Sep 2024 13:25:44 -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 1ss3rb-0001Gn-As for bug-gnu-emacs@gnu.org; Sat, 21 Sep 2024 13:25:43 -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 1ss3rb-0005Ko-1y for bug-gnu-emacs@gnu.org; Sat, 21 Sep 2024 13:25:43 -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=DtcTbWNknJdb+t3KYc81TXs1X69CIKOMK2kF5VK4upw=; b=ZlkBMNeOofjiciI9VBHPzHTu23FRTYO4q042q2UTrYsnrTnMNIZiZoLDPKj2UPvgGe1c5XD/p9Gq0bPXI931ukqMU8kH2up8oqLkIr1FuGOyKDkcIgHuT+CsXK6er0wIAD0IgytJ1QGDIW9RkPs2v33lUFB2+pFc3JgPKBCF3kIxPslOnmZsBD1SM/vqPamYccc0rYMQxJjtdY2f5Ier7udIYiwJdrR1Gd9nSkFqWuEg03l9frzmkxgDg8K9bjSU+IiAyojl91ULnOcGsHoqYHZMOCRB6dxPad7s8GPwoOTlqTxW4I2ud4ioe/ciaFtp+EMp3gNgFnh8Q4IovSt5qA==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ss3ru-0004gq-FS for bug-gnu-emacs@gnu.org; Sat, 21 Sep 2024 13:26:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Joseph Turner Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 21 Sep 2024 17:26:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72437 X-GNU-PR-Package: emacs X-Debbugs-Original-Cc: 72437@debbugs.gnu.org, "Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors" , Eli Zaretskii , Stefan Monnier Original-Received: via spool by submit@debbugs.gnu.org id=B.172693953417980 (code B ref -1); Sat, 21 Sep 2024 17:26:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 21 Sep 2024 17:25:34 +0000 Original-Received: from localhost ([127.0.0.1]:40289 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ss3rS-0004fr-12 for submit@debbugs.gnu.org; Sat, 21 Sep 2024 13:25:34 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:32868) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ss3rP-0004fc-Fj for submit@debbugs.gnu.org; Sat, 21 Sep 2024 13:25:32 -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 1ss3r4-0001EH-Dn for bug-gnu-emacs@gnu.org; Sat, 21 Sep 2024 13:25:10 -0400 Original-Received: from out-174.mta0.migadu.com ([2001:41d0:1004:224b::ae]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ss3r2-0005FP-1T for bug-gnu-emacs@gnu.org; Sat, 21 Sep 2024 13:25:10 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=breatheoutbreathe.in; s=key1; t=1726939503; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=y6Pw7wR1zVt+awK7/mCHQgBWj8cK0yuVEwwErHHSe78=; b=KdBZVoGZ4l9Z35DxrplZ0TH4XnH4SiPbTRMHnGHVUMqTNBCtGpQ9+cAH5uvvQpJeveiEdy abtfcFAPZ5RtcSWXx1oTLyc4G+6PFpN5N9AkzfAQNx/LMFGq/pcSiVGMXnG/vIaTNxv+bx zajfPISDAY274oNUz0tH6bKwNbLoXJE= In-Reply-To: (Eshel Yaron's message of "Sat, 21 Sep 2024 12:23:55 +0200") X-Migadu-Flow: FLOW_OUT Received-SPF: pass client-ip=2001:41d0:1004:224b::ae; envelope-from=joseph@breatheoutbreathe.in; helo=out-174.mta0.migadu.com X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no 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:292202 Archived-At: --=-=-= Content-Type: text/plain Eshel Yaron writes: > Joseph Turner writes: > >> Joseph Turner writes: >> >>> On August 13, 2024 10:07:23 PM PDT, Eshel Yaron wrote: >>>>Hi Stefan, >>>> >>>>Stefan Monnier writes: >>>> >>>>>> Let's hear what Stefan thinks (and anyone else who has an >>>>>> opinion or some case other than electric-pair-mode). >>>>> >>>>> I think the requested behavior makes a lot of sense, but I lost touch >>>>> with the way elec-pair works and interacts with other electric modes, so >>>>> I'm not sure how to make it work without breaking other things. >>>> >>>>In case you missed it, the patch I shared upthread might give you >>>>some ideas. It implements the requested behavior, safely, I think. >>>>So I would just ask Joseph to try it out for a while and see if it >>>>works as expected and if any other issues crop up :) >>> >>> Thanks for this patch! I am testing it in my daily config. So far >>> so good, and I'll report back after a few weeks of usage. >> >> I have been running this patch for over a month with no issue. > > That's great, thanks for testing it and for reporting back! > >> I vote to merge it! > > Agreed. Here's a full patch with tests, doc updates and a NEWS entry: Nice! How about also adding a test like the attached patch? --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Test-behavior-with-prefix-argument.patch >From 414a4b1fa09b0b976e74144430871b1b5a9ddbbe Mon Sep 17 00:00:00 2001 From: Joseph Turner Date: Sat, 21 Sep 2024 10:23:07 -0700 Subject: [PATCH] Test behavior with prefix argument * test/lisp/electric-tests.el (electric-pair-backspace-2) --- test/lisp/electric-tests.el | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/lisp/electric-tests.el b/test/lisp/electric-tests.el index 720313511a6..f1742fe3f0b 100644 --- a/test/lisp/electric-tests.el +++ b/test/lisp/electric-tests.el @@ -562,6 +562,14 @@ electric-pair-backspace-1 (electric-pair-delete-pair 1) (should (equal "" (buffer-string)))))) +(ert-deftest electric-pair-backspace-2 () + (save-electric-modes + (with-temp-buffer + (insert "((()))") + (goto-char 4) + (electric-pair-delete-pair 2) + (should (equal "()" (buffer-string)))))) + ;;; Undoing (ert-deftest electric-pair-undo-unrelated-state () -- 2.46.0 --=-=-=--