GNU bug report logs - #50236
27.2; electric-pair-mode is inconvenient in comint

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Augusto Stoffel <arstoffel@HIDDEN>; dated Sat, 28 Aug 2021 10:18:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
Removed tag(s) moreinfo. Request was from Lars Ingebrigtsen <larsi@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 50236 <at> debbugs.gnu.org:


Received: (at 50236) by debbugs.gnu.org; 24 Aug 2022 10:19:48 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Aug 24 06:19:48 2022
Received: from localhost ([127.0.0.1]:45696 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oQnUC-00069c-9g
	for submit <at> debbugs.gnu.org; Wed, 24 Aug 2022 06:19:48 -0400
Received: from quimby.gnus.org ([95.216.78.240]:47984)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1oQnUB-00069O-E7
 for 50236 <at> debbugs.gnu.org; Wed, 24 Aug 2022 06:19:47 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Type:MIME-Version:Message-ID:Date:References:
 In-Reply-To:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=OJ5YHYufNYoIEo74JZMYc5Wtkdlovax48a7bz/+VKW4=; b=CCxeq1K3tbSCBGxsy/fad56pg8
 VOl5c0tWjpwSeDAjcwzsz2roYuXGamFWhoyPSwGChgPuPNQPGReP89wSdmICHa2UKhll4tAVX7eNt
 gWlxC475zxz6PpFDTgxNVnR+4FMnBaHEOjKo+OJes/7p5uFWloQOL3ZECmMYK8EUT/eE=;
Received: from [84.212.220.105] (helo=joga)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1oQnU3-0004Jx-3N; Wed, 24 Aug 2022 12:19:41 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Augusto Stoffel <arstoffel@HIDDEN>
Subject: Re: bug#50236: 27.2; electric-pair-mode is inconvenient in comint
In-Reply-To: <87tu62sxt7.fsf@HIDDEN> (Augusto Stoffel's message of "Tue, 23
 Aug 2022 18:56:52 +0200")
References: <87bl5heuva.fsf@HIDDEN> <87zgn4nxv7.fsf@HIDDEN>
 <87tu642sso.fsf@HIDDEN> <87v8qk5kit.fsf@HIDDEN>
 <875yijuvzf.fsf@HIDDEN> <87tu62sxt7.fsf@HIDDEN>
Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAACBj
 SFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAD1BMVEUfWT/brS2Abn3g
 zrX///8fLI/6AAAAAWJLR0QEj2jZUQAAAAd0SU1FB+YIGAoHLjcUeFAAAAFxSURBVDjLdZSJtcQg
 CEWVaUBjA4oNROm/t8/iku0zc+ZErjwQyTg3zAdwcLi3efnJb/+Hawh9w6i+8gr3h62CLeGZAi1w
 BbA+6ArxkO0rwM8d7Au3zNPCjygR1UbnA1Qa1iE/QJvAItoTNO1QLwXZfWCeUq35KIAIay1X0PVE
 vVPH2lK9AK0KsddOLe0IMtCZEMWDw+6AM/SOnJz1zL0BIYMSBohLiiWQqzpVKvFhBuAkRKXXc+ZI
 s6ph+ae1rnL/NWmTdiuIpMQg7rYn/jCopG3Il/vgYgIC8hcWaPM+0GFmGTAlaDOJRGRw+Lpzbgo7
 4QYaJ6cTlKDLloNUics8IYMwyCtC9gtgIU4jYyxXm6xai1CVzJt5ENU/gVQ7cmipqdmYQUaZ4rw7
 IrPZudHaa8t9KClc1qlXsA64BlyGL+5x57fD20oqLAEuIF5e0v3s3QDewpZWvD/oqaJVO/caL8Pv
 4iXDPTa8wNdfzf1kn+APysxK5VK9dhMAAAAldEVYdGRhdGU6Y3JlYXRlADIwMjItMDgtMjRUMTA6
 MDc6NDYrMDA6MDCzKa94AAAAJXRFWHRkYXRlOm1vZGlmeQAyMDIyLTA4LTI0VDEwOjA3OjQ2KzAw
 OjAwwnQXxAAAAABJRU5ErkJggg==
X-Now-Playing: The Flying Lizards's _The Flying Lizards_: "The Window"
Date: Wed, 24 Aug 2022 12:19:35 +0200
Message-ID: <87k06yoseg.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview:  Augusto Stoffel <arstoffel@HIDDEN> writes: > This makes
 sense. However, in comint the "input" field has no field > property; only
 the output is labeled as such. So the suggestion to do > something special
 if inside a field wouldn't solve the o [...] 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 50236
Cc: 50236 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Augusto Stoffel <arstoffel@HIDDEN> writes:

> This makes sense.  However, in comint the "input" field has no field
> property; only the output is labeled as such.  So the suggestion to do
> something special if inside a field wouldn't solve the original problem
> described in the bug.

Ah, right.

> So the conclusion seems to be that a comint-specific
> electric-pair-skip-self function is needed (namely, one that narrows to
> the current field provided the current field property is nil, to avoid
> those performance issues.)

The other possible solution (that I mentioned, but didn't expand on) is
that we could just fix this in electric-pair without relying on
narrow-to-field.  That is, once electric-pair has found the matching
pair, we just look at the region between the two chars and see whether
they are part of the same field.  That should be reasonably fast, since
electric-pair already limits the range it's willing to search for a
pair.





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#50236; Package emacs. Full text available.

Message received at 50236 <at> debbugs.gnu.org:


Received: (at 50236) by debbugs.gnu.org; 23 Aug 2022 16:57:04 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Aug 23 12:57:04 2022
Received: from localhost ([127.0.0.1]:44926 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oQXD5-0000Gg-TP
	for submit <at> debbugs.gnu.org; Tue, 23 Aug 2022 12:57:04 -0400
Received: from mail-ed1-f49.google.com ([209.85.208.49]:44916)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <arstoffel@HIDDEN>) id 1oQXD3-0000G4-Ov
 for 50236 <at> debbugs.gnu.org; Tue, 23 Aug 2022 12:57:02 -0400
Received: by mail-ed1-f49.google.com with SMTP id t5so18813593edc.11
 for <50236 <at> debbugs.gnu.org>; Tue, 23 Aug 2022 09:57:01 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:from:to:cc;
 bh=Q3NfHAmh12KC11+ZCP9Eg0/ptWnWuSlgI2xIUiC4opM=;
 b=GMl71cxQOPDU4EVL3O0ErxLMIZKMImc2gLRrlmNW3VaCSSFJcVztKub8kSUqwItf4x
 f6jkOoZnkvcBsu+bPpcQbcEb6UnCH8KW/sfiLLGoLiqn+W9tqJaYnN4C5sgEfILsbQld
 MnDG/kQXzq/1kLd865hRFp4Ntd9jRFb/E9unamG9eMOguxJKPlA8cSsi2EGQWZEZnlV9
 on1+i605XEjm15GfwF3gyB6lRXV+IROWISFC69dQR4Tll0kOuKrFYaJr76Id+NwU472T
 5tYS/B7owjkBpBImoH4g1tHjBKWtfHG9MU5BgCkMZS+rpF7lNQA3NT5eHyV/g+onyGm4
 jxTA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:x-gm-message-state:from:to:cc;
 bh=Q3NfHAmh12KC11+ZCP9Eg0/ptWnWuSlgI2xIUiC4opM=;
 b=cpc3MJl0L4U27wrQwJt25QGI28uMMANz6Fobvm2DmEIVeKsCJ14Za5cOnMx7UY7T7Q
 o/QXQ14o5cnvNIXaU0/Jy3myVvm5RSGwPysZgnEH/HngF6yRsKWFzKiNZb+0LrxL3wNr
 DgJFEOoo2I7hnH2oWplXgTZKlVZ6Y5GiRfUNmIhFV7Wdr/lxgp/UpAWgjTHxiE7sjd+b
 38IwrBORyH7jxXvWHySBagYHgDMRrjgqvENVw4lvPKA0oqYwvh33hJBrOkM3WBImsskd
 DaEkXje0u0CSZKIVS5cas/dyBxRIJwr/ZXiKonyu+blubHHc/j9694ABSvhUSozN8JML
 Lmug==
X-Gm-Message-State: ACgBeo2OWorXYZO2ZtYho4bleE6DdKSB5KxLFggxBCaCtcdvnpqRuBf9
 0K31z7jnxUae2knNwX2OiskG8U8oiJE=
X-Google-Smtp-Source: AA6agR6xqSOTPeCBY3EPcvVpCnulEu+XL/hktSk3lF1WWTvI5SpvdtfLvrE6hkWZlb1lJgHix6ob2w==
X-Received: by 2002:a05:6402:454:b0:447:59a8:fc7d with SMTP id
 p20-20020a056402045400b0044759a8fc7dmr789301edw.68.1661273815304; 
 Tue, 23 Aug 2022 09:56:55 -0700 (PDT)
Received: from ars3 ([2a02:8109:8ac0:56d0::157b])
 by smtp.gmail.com with ESMTPSA id
 b1-20020a1709063ca100b00728f6d4d0d7sm109656ejh.67.2022.08.23.09.56.53
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Tue, 23 Aug 2022 09:56:54 -0700 (PDT)
From: Augusto Stoffel <arstoffel@HIDDEN>
To: Lars Ingebrigtsen <larsi@HIDDEN>
Subject: Re: bug#50236: 27.2; electric-pair-mode is inconvenient in comint
In-Reply-To: <875yijuvzf.fsf@HIDDEN> (Lars Ingebrigtsen's message of "Tue,
 23 Aug 2022 11:53:24 +0200")
References: <87bl5heuva.fsf@HIDDEN> <87zgn4nxv7.fsf@HIDDEN>
 <87tu642sso.fsf@HIDDEN> <87v8qk5kit.fsf@HIDDEN>
 <875yijuvzf.fsf@HIDDEN>
Date: Tue, 23 Aug 2022 18:56:52 +0200
Message-ID: <87tu62sxt7.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 50236
Cc: 50236 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

On Tue, 23 Aug 2022 at 11:53, Lars Ingebrigtsen <larsi@HIDDEN> wrote:

>
> Augusto Stoffel <arstoffel@HIDDEN> writes:
>
>>> That would make sense in this case...  I'm trying to think of instances
>>> where it wouldn't make sense, and I can't think of any.
>
> [...]
>
>> So I guess my question here is: does it make sense for a major mode with
>> a notion of "code blocks" set field properties as part of the
>> font-locking?  Or is there any reason not to mix up fields with
>> font-locking?
>
> Hm, that's an interesting question.  I think that, basically, the only
> usage for the "field" thing is to divide a line up into bits so that
> `C-a' takes you to the start of the field instead of the start of the
> line.  Extending the "field" thing to mark larger blocks is might well
> make sense.
>
> Anyway, this reminds me of a performance problem we have when making
> commands field sensitive: It's generally kinda slow.
>
> It's no problem in the `C-a' case -- we're limited to the current line,
> so our search for field properties is very short.  I was making some
> other command field sensitive (I forget which), but had to abandon it,
> because it was too slow.  The problem is, generally, that when you're
> not in a field, you want to find the end the previous field and delimit
> the command to that region.
>
> However, the previous field may be anywhere, so the searches for the
> field text property goes back to point-min.  And that's just unworkably
> slow for functions that trigger a lot -- and I think that this may be
> the case for electric-pair-mode, too.
>
> I mean -- we could delimit electric-pair-mode to the current field, if
> there is one, but we can't do the same if we're not in a field.

This makes sense.  However, in comint the "input" field has no field
property; only the output is labeled as such.  So the suggestion to do
something special if inside a field wouldn't solve the original problem
described in the bug.

So the conclusion seems to be that a comint-specific
electric-pair-skip-self function is needed (namely, one that narrows to
the current field provided the current field property is nil, to avoid
those performance issues.)




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#50236; Package emacs. Full text available.

Message received at 50236 <at> debbugs.gnu.org:


Received: (at 50236) by debbugs.gnu.org; 23 Aug 2022 09:53:36 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Aug 23 05:53:36 2022
Received: from localhost ([127.0.0.1]:42619 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oQQbI-0005FQ-Cl
	for submit <at> debbugs.gnu.org; Tue, 23 Aug 2022 05:53:36 -0400
Received: from quimby.gnus.org ([95.216.78.240]:36640)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1oQQbF-0005FC-IV
 for 50236 <at> debbugs.gnu.org; Tue, 23 Aug 2022 05:53:34 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Type:MIME-Version:Message-ID:Date:References:
 In-Reply-To:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=32avkb2LJzN1cJvYf7bB78XE/+erxGzaZ6SG3HuJX/U=; b=WhIb/hBc2Q0OYVTU1Q75p8Zj+A
 jlXGIbwiabEhtv1GYpLzO8YIGjhFMY9AhbT9SSIsOC8fBBoE2tZjEVyU3mL1h91B/OS7/O9KaE1W7
 1dQu7eo3HnOHDcociwSb0WgD8LOEWSq/6gWPWd7rvM6Fd8gWDNU+7cz0qBnHGlzY1XxU=;
Received: from [84.212.220.105] (helo=joga)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1oQQb7-00079N-2Q; Tue, 23 Aug 2022 11:53:27 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Augusto Stoffel <arstoffel@HIDDEN>
Subject: Re: bug#50236: 27.2; electric-pair-mode is inconvenient in comint
In-Reply-To: <87v8qk5kit.fsf@HIDDEN> (Augusto Stoffel's message of "Mon, 22
 Aug 2022 18:07:54 +0200")
References: <87bl5heuva.fsf@HIDDEN> <87zgn4nxv7.fsf@HIDDEN>
 <87tu642sso.fsf@HIDDEN> <87v8qk5kit.fsf@HIDDEN>
Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAACBj
 SFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAD1BMVEUzGBdPKiJtTD+f
 emP///+YbcQvAAAAAWJLR0QEj2jZUQAAAAd0SU1FB+YIFwkHALHn25AAAAGQSURBVDjLbZTbdcAg
 CEAlXQDIAgEXaGT/3QqiiUnKjx4vD3loKSFAiFC+QgEoVXA5r0YpEiCRq4H+7n5YAOzAsKAjQTGu
 tbHaVptqVbWTpYNqZq2Z1b1Z31utCarvm+0GvgmNVrX4HcGAqHmUHQEEaCMPExZ78zRc8MfcP1Hm
 E678KiRxr2qihDcoaRHInYwEaSyLJIEvKAuAj8FwlUewWMBcLhtEfAdnSdKPYAnOZ5zOGAvYzxF8
 bZXrdwu5ol+ZVwfMOmPcrgLQAhYLLyArf10pbhIWD1CIN+9386YLPWMgn2a935iZDABsvzEHpoY5
 c7O6bGcHZlIewbWmK3eW+lkxhqY2RfEqOwj6CKa+K5w3OBRa0yYdVlkadRTulVf1RNYEs4Fy9xaW
 uRJSVmF51gqnI34XMUTlDcYAuYW+qjs99RhrEZlF+zPzlsgcBowpogDsPXHQtaHktPR58yyF7q7j
 iIJjFpHyNcXidqQk0iuSgAotqfjU+VPrY4rX5wF97zW46rS8FChLcv/8Rh38AdXYQFTLI7H7AAAA
 JXRFWHRkYXRlOmNyZWF0ZQAyMDIyLTA4LTIzVDA5OjA3OjAwKzAwOjAws9CHUwAAACV0RVh0ZGF0
 ZTptb2RpZnkAMjAyMi0wOC0yM1QwOTowNzowMCswMDowMMKNP+8AAAAASUVORK5CYII=
X-Now-Playing: Fairport Convention's _Come All Ye (6)_: "Dirty Linen"
Date: Tue, 23 Aug 2022 11:53:24 +0200
Message-ID: <875yijuvzf.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview: Augusto Stoffel <arstoffel@HIDDEN> writes: >> That would
 make sense in this case... I'm trying to think of instances >> where it
 wouldn't make sense, and I can't think of any. [...] 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 50236
Cc: 50236 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Augusto Stoffel <arstoffel@HIDDEN> writes:

>> That would make sense in this case...  I'm trying to think of instances
>> where it wouldn't make sense, and I can't think of any.

[...]

> So I guess my question here is: does it make sense for a major mode with
> a notion of "code blocks" set field properties as part of the
> font-locking?  Or is there any reason not to mix up fields with
> font-locking?

Hm, that's an interesting question.  I think that, basically, the only
usage for the "field" thing is to divide a line up into bits so that
`C-a' takes you to the start of the field instead of the start of the
line.  Extending the "field" thing to mark larger blocks is might well
make sense.

Anyway, this reminds me of a performance problem we have when making
commands field sensitive: It's generally kinda slow.

It's no problem in the `C-a' case -- we're limited to the current line,
so our search for field properties is very short.  I was making some
other command field sensitive (I forget which), but had to abandon it,
because it was too slow.  The problem is, generally, that when you're
not in a field, you want to find the end the previous field and delimit
the command to that region.

However, the previous field may be anywhere, so the searches for the
field text property goes back to point-min.  And that's just unworkably
slow for functions that trigger a lot -- and I think that this may be
the case for electric-pair-mode, too.

I mean -- we could delimit electric-pair-mode to the current field, if
there is one, but we can't do the same if we're not in a field.  So if
you have

---
*Here's a field with (*


Here we, much later in the buffer, are outside of a field and we type )
---

we can't (for these performance reasons) just use a `narrow-to-field'
first when checking whether that ) matches that other (.  Once we have
the pairs, we could check whether both are in the same field, though.





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#50236; Package emacs. Full text available.

Message received at 50236 <at> debbugs.gnu.org:


Received: (at 50236) by debbugs.gnu.org; 22 Aug 2022 16:08:09 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Aug 22 12:08:09 2022
Received: from localhost ([127.0.0.1]:41572 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oQ9yD-0000to-2L
	for submit <at> debbugs.gnu.org; Mon, 22 Aug 2022 12:08:09 -0400
Received: from mail-ej1-f53.google.com ([209.85.218.53]:42895)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <arstoffel@HIDDEN>) id 1oQ9y9-0000tJ-5G
 for 50236 <at> debbugs.gnu.org; Mon, 22 Aug 2022 12:08:07 -0400
Received: by mail-ej1-f53.google.com with SMTP id ca13so10897456ejb.9
 for <50236 <at> debbugs.gnu.org>; Mon, 22 Aug 2022 09:08:05 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:from:to:cc;
 bh=Z/wwgsRl8UdoJkwKXheko/goIyjQzxAk8YmAWUGVZgY=;
 b=HEe60dCxdBso6ULb/9hAjvrfhU3G4UR3HvAR29LzZsNegGUsvZMxBLShm8UDAkHTnQ
 znxWPTC2pSeAHdhcqg3TuJfjVSd5xaqOnUELNzg/p0KABHHtAOY/oSksqvaJ9d5wtsFd
 QdQ/rvJivfUsYc0brFepsP2XQilHB5SXCGModza0GvIt/7gZCed8eQtAtMWd4VneQFC0
 E187Eml9aEInPXYGW9be0BZL7RMDoHrraF7hccDVSf7v5rbFD/oXHt5ENmANAvYGTNMQ
 t3oBwqPitnKY2hWZ7yR2IjeKQrgtoUBBuXEXYSKvx+vZ81bYJorgnxLoNSAwvW1OP3O9
 da4g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:x-gm-message-state:from:to:cc;
 bh=Z/wwgsRl8UdoJkwKXheko/goIyjQzxAk8YmAWUGVZgY=;
 b=wI7cm70enGKzVzhoPd48Sbpsj4G4XI5WMB/eDy6t2wSHdCt5WjFJ3IdhQI+7T1ySVF
 wwkATQp8ar+mtQk43M75SmpQ7DrOoHMCmQjLl+jeOVJtjtQmJnGDs5VUxiNnhPzwKnkW
 qLfFGLLYxtKokHdRuU9EWAOSy0gf5KCcIRDIGX8XHO4wwOYySrFjABxvgZ2Jp4q6yyvE
 DmejBH07K17gRpy/QotR+oZxl77fF29WWh0GoX/cseYXPMRnb9/rxqo08EbPqThc1u40
 JJbB06UGix7wx911OuwE+FY/6hAHvl2Wkp2x+9r65XT2Ug9CoVBNWMHrpwJNTjq/Shej
 oFrg==
X-Gm-Message-State: ACgBeo2MaOYmTKD09h1XT8dORrijL9zIIyo5gHfx8moVVhRp9cDZ94hH
 A23ZovLdwCGVVq9ZlkaOsnK7AlqD5Sk=
X-Google-Smtp-Source: AA6agR4ugMdsFEQ6JLeUY52clhmEZYthrgfCYZXbKWI4bTGaj/xPTkphAR4f0YjMA1mNrKEhu1yIQg==
X-Received: by 2002:a17:907:75e8:b0:73d:53dc:661d with SMTP id
 jz8-20020a17090775e800b0073d53dc661dmr9547497ejc.738.1661184478034; 
 Mon, 22 Aug 2022 09:07:58 -0700 (PDT)
Received: from ars3 ([2a02:8109:8ac0:56d0::157b])
 by smtp.gmail.com with ESMTPSA id
 o21-20020a170906769500b0073d685a2985sm3370063ejm.108.2022.08.22.09.07.55
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 22 Aug 2022 09:07:56 -0700 (PDT)
From: Augusto Stoffel <arstoffel@HIDDEN>
To: Lars Ingebrigtsen <larsi@HIDDEN>
Subject: Re: bug#50236: 27.2; electric-pair-mode is inconvenient in comint
In-Reply-To: <87tu642sso.fsf@HIDDEN> (Lars Ingebrigtsen's message of "Mon,
 22 Aug 2022 17:37:27 +0200")
References: <87bl5heuva.fsf@HIDDEN> <87zgn4nxv7.fsf@HIDDEN>
 <87tu642sso.fsf@HIDDEN>
Date: Mon, 22 Aug 2022 18:07:54 +0200
Message-ID: <87v8qk5kit.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 50236
Cc: 50236 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

On Mon, 22 Aug 2022 at 17:37, Lars Ingebrigtsen <larsi@HIDDEN> wrote:

>
> Augusto Stoffel <arstoffel@HIDDEN> writes:
>
>> 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-self
>>                                                        'electric-pair-skip-in-field)))
>>
>> Perhaps `electric-pair-default-skip-self' should always narrow to the
>> current field?
>
> That would make sense in this case...  I'm trying to think of instances
> where it wouldn't make sense, and I can't think of any.

There's a second question of relevance here: would this change help
solving similar bugs in other modes?  Consider for instance an Org file
like this


    (

    #+begin_src
      f(<type close parens here>)
    #+end_src

or a Markdown file like this

    (

    ```
      f(<type close parens here>)
    ```

Of course each of these modes could define their own
electric-pair-skip-self, but ideally a general mechanism to deal with
this situation should we provided.

So I guess my question here is: does it make sense for a major mode with
a notion of "code blocks" set field properties as part of the
font-locking?  Or is there any reason not to mix up fields with
font-locking?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#50236; Package emacs. Full text available.
Added tag(s) moreinfo. Request was from Lars Ingebrigtsen <larsi@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 50236 <at> debbugs.gnu.org:


Received: (at 50236) by debbugs.gnu.org; 22 Aug 2022 15:37:40 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Aug 22 11:37:40 2022
Received: from localhost ([127.0.0.1]:41517 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oQ9Uh-0006JL-SW
	for submit <at> debbugs.gnu.org; Mon, 22 Aug 2022 11:37:40 -0400
Received: from quimby.gnus.org ([95.216.78.240]:56072)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1oQ9Uf-0006J5-PB
 for 50236 <at> debbugs.gnu.org; Mon, 22 Aug 2022 11:37:38 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Type:MIME-Version:Message-ID:Date:References:
 In-Reply-To:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=Db1lF7VO8u+tUh5aRSuu6n+BTNVHn450qaGm7DyanK4=; b=CW0arKxIUULAxWsLfj4zJdZZ4E
 vICd6Vr3y2wO6ULlbsjlq+Nrz+nXqPKY2cMqU9tAcBLpbvvPaPLRx16aVlkWvj6hhlpzRNwTxmQeM
 Nm6cDB8rc39loLNqYXV1Adj/XnQQOQHJK7oaPJwu+TT9JmyO7P2r1akffboASdRDPRBw=;
Received: from [84.212.220.105] (helo=joga)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1oQ9UX-0006yW-K5; Mon, 22 Aug 2022 17:37:31 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Augusto Stoffel <arstoffel@HIDDEN>
Subject: Re: bug#50236: 27.2; electric-pair-mode is inconvenient in comint
In-Reply-To: <87zgn4nxv7.fsf@HIDDEN> (Augusto Stoffel's message of "Sun, 06
 Feb 2022 10:33:00 +0100")
References: <87bl5heuva.fsf@HIDDEN> <87zgn4nxv7.fsf@HIDDEN>
X-Now-Playing: Fieh's _Blue Note Re:imagined (2)_: "Armageddon"
Date: Mon, 22 Aug 2022 17:37:27 +0200
Message-ID: <87tu642sso.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview: Augusto Stoffel <arstoffel@HIDDEN> writes: > 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))) [...] 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 50236
Cc: 50236 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Augusto Stoffel <arstoffel@HIDDEN> writes:

> 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-self
>                                                        'electric-pair-skip-in-field)))
>
> Perhaps `electric-pair-default-skip-self' should always narrow to the
> current field?

That would make sense in this case...  I'm trying to think of instances
where it wouldn't make sense, and I can't think of any.

So perhaps we should make this change in general?

Anybody have any opinions here?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#50236; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 6 Feb 2022 09:33:22 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Feb 06 04:33:22 2022
Received: from localhost ([127.0.0.1]:36431 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nGdv7-00054r-Ux
	for submit <at> debbugs.gnu.org; Sun, 06 Feb 2022 04:33:22 -0500
Received: from lists.gnu.org ([209.51.188.17]:44392)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <arstoffel@HIDDEN>) id 1nGdv6-00054k-2x
 for submit <at> debbugs.gnu.org; Sun, 06 Feb 2022 04:33:20 -0500
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 <arstoffel@HIDDEN>)
 id 1nGdv4-0004Bm-QQ
 for bug-gnu-emacs@HIDDEN; Sun, 06 Feb 2022 04:33:19 -0500
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 <arstoffel@HIDDEN>)
 id 1nGdv2-0002st-VE
 for bug-gnu-emacs@HIDDEN; Sun, 06 Feb 2022 04:33:18 -0500
Received: by mail-ed1-x535.google.com with SMTP id cz16so5211884edb.8
 for <bug-gnu-emacs@HIDDEN>; 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)
Received: from ars3 ([2a02:8109:8ac0:56d0::a4e1])
 by smtp.gmail.com with ESMTPSA id j11sm607365ejb.110.2022.02.06.01.33.00
 for <bug-gnu-emacs@HIDDEN>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sun, 06 Feb 2022 01:33:01 -0800 (PST)
From: Augusto Stoffel <arstoffel@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: Re: 27.2; electric-pair-mode is inconvenient in comint
References: <87bl5heuva.fsf@HIDDEN>
Date: Sun, 06 Feb 2022 10:33:00 +0100
In-Reply-To: <87bl5heuva.fsf@HIDDEN> (Augusto Stoffel's message of "Sat, 28
 Aug 2021 12:17:29 +0200")
Message-ID: <87zgn4nxv7.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.91 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
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@HIDDEN; 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-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

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 <arstoffel@HIDDEN> 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:
>
>     |
>     (|)
>     ()|
>     ())|




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#50236; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 28 Aug 2021 10:17:35 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Aug 28 06:17:35 2021
Received: from localhost ([127.0.0.1]:53440 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mJvP5-0002ET-1G
	for submit <at> debbugs.gnu.org; Sat, 28 Aug 2021 06:17:35 -0400
Received: from lists.gnu.org ([209.51.188.17]:52630)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <arstoffel@HIDDEN>) id 1mJvP3-0002EK-Gd
 for submit <at> debbugs.gnu.org; Sat, 28 Aug 2021 06:17:33 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:50150)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <arstoffel@HIDDEN>)
 id 1mJvP3-0005CR-BA
 for bug-gnu-emacs@HIDDEN; Sat, 28 Aug 2021 06:17:33 -0400
Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]:51765)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <arstoffel@HIDDEN>)
 id 1mJvP1-0008Fu-Un
 for bug-gnu-emacs@HIDDEN; Sat, 28 Aug 2021 06:17:33 -0400
Received: by mail-wm1-x332.google.com with SMTP id u15so5415868wmj.1
 for <bug-gnu-emacs@HIDDEN>; Sat, 28 Aug 2021 03:17:31 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:subject:date:message-id:mime-version
 :content-transfer-encoding;
 bh=5UKuD5fl1PBkHdppd4VblTR8gqfIBQyXIIjI8L5/aTI=;
 b=spxL3KWLWUHXgeC/7zcECan3Pgiqo7wdQTLo7L9VjvBPe4UFbmg0PSHdDbZ6U+3+NP
 bfysjXll65lcyRTUWig1Z1qYgZTXzfb1QVrOpkOVeTXqCWIt+v1AZhYQqABQSKyZYPCS
 kQQEDxIX/NaqgglR6b+0Axf+Ey1r+CEAOmpGi+9Yc+Xu9zNx6vsxCZv5uCWljOzKAUo3
 wG+NZUlovIb6UHor0itFRTIf6VUDmekUBg/k13LpOQ3hhTPEnLoPngMXLn0G9xCY284O
 CO6vAiXPopD/vFcstI9Wm/9A3tDJCfzgL3JI8iHPCG4KjuD2m0175XWjFTFhIj6jqyjD
 bRWQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:date:message-id:mime-version
 :content-transfer-encoding;
 bh=5UKuD5fl1PBkHdppd4VblTR8gqfIBQyXIIjI8L5/aTI=;
 b=FauxpUdHDXpau4OIa5y5jO68ISO8OyXe4wbEt8IXkC03PiR6IlYMiHfQeuMGU9lj9J
 oN57ZHZqqVCDh7CHU64PFS8NNesGdY3pk3pxsOVQHSf8NPpm1uZtf2ZKLwECLtUfUvTa
 62dmpii9z5iNdEFAC92or1nqNWXSAnYwjq8oNRYOXiS4Nz9cctrrD3eqNTEbYYnxXoA3
 ae+HZnGo9lsP4kU3jm17aChKQ+bdFv07mTvUb5qGwpzU8czHv6x+6HmbZgt6pCXU/dKu
 Z/KV57P37TghqayAWDomb/cKhRgz/4CJ3XgTcPlaSxZfUs74dOlkbDMo32kkSiQuXprK
 MFfQ==
X-Gm-Message-State: AOAM533VfpjziHFM+929vmGMKsIfYek0rtYADReRFsrUa7YR8CF23tKA
 MkFNqjA3hCCrl+7gAIc7IX10bzplxCoCjg==
X-Google-Smtp-Source: ABdhPJwH0sS3Q6pJ4hgIlI60SVWQ24varDjpbghXQSrlbCgs1HDQVX6n+Q0q7k8QBwawxGs4586A7w==
X-Received: by 2002:a1c:e90a:: with SMTP id q10mr24012427wmc.39.1630145850255; 
 Sat, 28 Aug 2021 03:17:30 -0700 (PDT)
Received: from ars3 ([2a02:8109:8ac0:56d0::ae3f])
 by smtp.gmail.com with ESMTPSA id v28sm8974453wrv.93.2021.08.28.03.17.29
 for <bug-gnu-emacs@HIDDEN>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sat, 28 Aug 2021 03:17:29 -0700 (PDT)
From: Augusto Stoffel <arstoffel@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 27.2; electric-pair-mode is inconvenient in comint
Date: Sat, 28 Aug 2021 12:17:29 +0200
Message-ID: <87bl5heuva.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass client-ip=2a00:1450:4864:20::332;
 envelope-from=arstoffel@HIDDEN; helo=mail-wm1-x332.google.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 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_NONE=-0.0001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

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 prom=
pt, I get
the following sequence of states (where | indicates the point)

    |
    (|)
    ()|)
    ())|

where I would instead expect the obvious:

    |
    (|)
    ()|
    ())|




Acknowledgement sent to Augusto Stoffel <arstoffel@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#50236; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sat, 24 Sep 2022 15:15:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.