From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Augusto Stoffel Newsgroups: gmane.emacs.bugs Subject: bug#50236: 27.2; electric-pair-mode is inconvenient in comint Date: Sun, 06 Feb 2022 10:33:00 +0100 Message-ID: <87zgn4nxv7.fsf@gmail.com> References: <87bl5heuva.fsf@gmail.com> 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="8171"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.91 (gnu/linux) To: 50236@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Feb 06 10:34:10 2022 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 1nGdvu-0001zi-I6 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 06 Feb 2022 10:34:10 +0100 Original-Received: from localhost ([::1]:43318 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nGdvt-0004s4-CV for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 06 Feb 2022 04:34:09 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:43554) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nGdvm-0004pX-PY for bug-gnu-emacs@gnu.org; Sun, 06 Feb 2022 04:34:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:42544) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nGdvm-0002vK-Fz for bug-gnu-emacs@gnu.org; Sun, 06 Feb 2022 04:34:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nGdvm-00056K-D4 for bug-gnu-emacs@gnu.org; Sun, 06 Feb 2022 04:34:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Augusto Stoffel Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 06 Feb 2022 09:34:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50236 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.164414000219526 (code B ref -1); Sun, 06 Feb 2022 09:34:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 6 Feb 2022 09:33:22 +0000 Original-Received: from localhost ([127.0.0.1]:36431 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nGdv7-00054r-Ux for submit@debbugs.gnu.org; Sun, 06 Feb 2022 04:33:22 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:44392) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nGdv6-00054k-2x for submit@debbugs.gnu.org; Sun, 06 Feb 2022 04:33:20 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:43504) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nGdv4-0004Bm-QQ for bug-gnu-emacs@gnu.org; Sun, 06 Feb 2022 04:33:19 -0500 Original-Received: from [2a00:1450:4864:20::535] (port=41525 helo=mail-ed1-x535.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nGdv2-0002st-VE for bug-gnu-emacs@gnu.org; Sun, 06 Feb 2022 04:33:18 -0500 Original-Received: by mail-ed1-x535.google.com with SMTP id cz16so5211884edb.8 for ; Sun, 06 Feb 2022 01:33:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:references:date:in-reply-to:message-id:user-agent :mime-version:content-transfer-encoding; bh=pptVrnnMh3L4ziTlDgWtpfBsJZCnxH5iXF4w0kLy/gs=; b=NliaF/wx83KHwuWQloA/cVoWT/jQ9bGPXF9nhaEqlK1Ha1z+uZ1LcD3wd7feYxUpK4 ITcyoS0OGPmm8pB5GcspW+XoH2oDNDIe/Kfoe1O+rMpbx3+2qRM5GZq3sFXNsU4ijiYj zSgbpfNRZNhwsJQ5dYsdU3Wo++flvQO4FNpdSlUdS3S+HIwUTEAnv7+dSNywYWbdEBy8 w0uV+AwkQQ7TYQNjZXiEt70jTXyOu2BCBLNmEbCK52NWtVLosL85DcVa/Rs7RJEZFPJz L8IAsZcCjwhqmxElNMDJlE5rTHYPMX6TU/PjTCFIBHH36Byr0QOUUyRyBs1mhKRsIxl5 gElA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=pptVrnnMh3L4ziTlDgWtpfBsJZCnxH5iXF4w0kLy/gs=; b=BnTzv/Anoy3Iqf7OClIO+R0Kq9EwjGjrUgfFhpSmZdZvVTM7tZEE1zIQ23NBdxyJWB 93rZOsOU174HUYw8J7vMuzMfhL/iOmRhT4vQmbQAcCkLCB4buNXdBfQScmoLCG2Y1skt NJ+n/2O0eUYBKhbHHG/mpdHXIowy5gNqKegKFRiQ353aKKF1D2WNXuAEXnnIim7ZzeRV 3f0xk7uUqrk6EJNJZQ5vsQC18Hq9naN2Zx/qdOP1lsoYrHYPLgWRUNBIxsVr3Z51KwNO JoWvrj4FEB4bMfba9QhEXH+jMIYLbglpTwL8ZOMx5aCNWAZaVpVyyp+R+7rRtHYyXWPr otKw== X-Gm-Message-State: AOAM531L9FoGvAK2lkaBS62eURxtfjS7caEPueuyqr9SCEVQ0QnKTdZC rPMmiOMpIlHXrSy419fo+8xFPUD4M/g= X-Google-Smtp-Source: ABdhPJz0wKvP4PA3NutHxC47ajEvbsV4BKdJtp2utfCk7JpLlwweIs3eEGJ8tL+ZPXTchHVsMx96rQ== X-Received: by 2002:a05:6402:348b:: with SMTP id v11mr8068655edc.58.1644139981769; Sun, 06 Feb 2022 01:33:01 -0800 (PST) Original-Received: from ars3 ([2a02:8109:8ac0:56d0::a4e1]) by smtp.gmail.com with ESMTPSA id j11sm607365ejb.110.2022.02.06.01.33.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Feb 2022 01:33:01 -0800 (PST) In-Reply-To: <87bl5heuva.fsf@gmail.com> (Augusto Stoffel's message of "Sat, 28 Aug 2021 12:17:29 +0200") X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::535 (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::535; envelope-from=arstoffel@gmail.com; helo=mail-ed1-x535.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, PDS_HP_HELO_NORDNS=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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" Xref: news.gmane.io gmane.emacs.bugs:226143 Archived-At: The following quick fix works for me: (defun electric-pair-skip-in-field (char) (save-restriction (narrow-to-region (field-beginning) (field-end)) (electric-pair-default-skip-self char))) (add-hook 'comint-mode-hook (lambda () (setq-local electric-pair-skip-s= elf 'electric-pair-skip-= in-field))) Perhaps `electric-pair-default-skip-self' should always narrow to the current field? There are a few more situations where electric-pair-mode looks to far; for instance, when inside an org src block, mismatched parenthesis outside the block shouldn't matter. So maybe an even more general solution is in order. On Sat, 28 Aug 2021 at 12:17, Augusto Stoffel wrote: > In comint buffers, electric pair mode should only look at the current > input region to decide whether to skip over a closing bracket or add a > new one. Otherwise, it gets confused about mismatched delimiters in > previous inputs or outputs. > > To give an example, if I enter, in a fresh shell > > X=3D'(' > > at the first prompt, and then type =E2=80=9C())=E2=80=9D in the second pr= ompt, I get > the following sequence of states (where | indicates the point) > > | > (|) > ()|) > ())| > > where I would instead expect the obvious: > > | > (|) > ()| > ())|