From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#33840: electric-pair-mode breaks self-insert-command Date: Wed, 10 Jul 2019 09:39:56 +0000 Message-ID: <20190710093956.GA4109@ACM> References: <20181223023841.GA4289@ACM> <87r26yq1dn.fsf@mouse.gnus.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="137282"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mutt/1.10.1 (2018-07-13) Cc: 33840@debbugs.gnu.org To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Jul 10 11:41:09 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hl965-000Zab-KD for geb-bug-gnu-emacs@m.gmane.org; Wed, 10 Jul 2019 11:41:09 +0200 Original-Received: from localhost ([::1]:59538 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hl964-00019c-Bs for geb-bug-gnu-emacs@m.gmane.org; Wed, 10 Jul 2019 05:41:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54602) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hl95z-00019U-9X for bug-gnu-emacs@gnu.org; Wed, 10 Jul 2019 05:41:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hl95x-0002lj-UD for bug-gnu-emacs@gnu.org; Wed, 10 Jul 2019 05:41:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:54245) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hl95x-0002lP-QG for bug-gnu-emacs@gnu.org; Wed, 10 Jul 2019 05:41:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hl95x-00063i-Jh for bug-gnu-emacs@gnu.org; Wed, 10 Jul 2019 05:41:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 10 Jul 2019 09:41:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 33840 X-GNU-PR-Package: emacs Original-Received: via spool by 33840-submit@debbugs.gnu.org id=B33840.156275160423218 (code B ref 33840); Wed, 10 Jul 2019 09:41:01 +0000 Original-Received: (at 33840) by debbugs.gnu.org; 10 Jul 2019 09:40:04 +0000 Original-Received: from localhost ([127.0.0.1]:34833 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hl952-00062P-5O for submit@debbugs.gnu.org; Wed, 10 Jul 2019 05:40:04 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:42931 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1hl94y-00061q-63 for 33840@debbugs.gnu.org; Wed, 10 Jul 2019 05:40:03 -0400 Original-Received: (qmail 48495 invoked by uid 3782); 10 Jul 2019 09:39:58 -0000 Original-Received: from acm.muc.de (p4FE15E52.dip0.t-ipconnect.de [79.225.94.82]) by colin.muc.de (tmda-ofmipd) with ESMTP; Wed, 10 Jul 2019 11:39:56 +0200 Original-Received: (qmail 4131 invoked by uid 1000); 10 Jul 2019 09:39:56 -0000 Content-Disposition: inline In-Reply-To: <87r26yq1dn.fsf@mouse.gnus.org> X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:162606 Archived-At: Hello, Lars. On Wed, Jul 10, 2019 at 00:39:00 +0200, Lars Ingebrigtsen wrote: > Alan Mackenzie writes: > > In the master branch, put the following into *scratch* and evaluate it: > > (defun s-i-c () > > (interactive) > > (self-insert-command 1)) > > (local-set-key "(" 's-i-c)) > > On typing "(", it will be seen that the self-insert-command does its > > job, correctly entering "(" into *scratch*. > > Now do M-x electric-pair-mode. > > If you now type "(", self-insert-command wrongly enters "()" into the > > buffer. This is a bug, and is the root cause of bug #33794. > I must be misunderstanding something -- isn't the entire point of > electric-pair-mode that it inserts the corresponding parenthesis when > self-insert-command is called on one of the magical characters? But the entire point of (self-insert-command 1) is to insert exactly one copy of what was just typed. With electric-pair-mode enabled, it no longer does this; it does something else instead. self-insert-command is a primitive, and it shouldn't be modified to do other things. Instead these other things should be done alongside the primitive, or after it. Similarly, you would not modify + such that (+ 2 3) => 6, even if you had a use case where you wanted this strange arithmetic. Because of this change to self-insert-command, other uses of it (other than when bound directly to a key) fail. This happened in bug #33794 where this change to self-insert-command broke c-electric-brace. This has since been worked around by other means. Being realistic, I now don't really expect this bug to be fixed. It would cost too much. But if you are going to close it, please mark it as "won't fix" and _not_ "not a bug". Thanks! > -- > (domestic pets only, the antidote for overdose, milk.) > bloggy blog: http://lars.ingebrigtsen.no -- Alan Mackenzie (Nuremberg, Germany).