From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Newsgroups: gmane.emacs.bugs Subject: bug#33794: 26.1; electric-pair-mode breaks auto-newline minor mode of cc-mode Date: Sat, 22 Dec 2018 00:45:20 +0000 Message-ID: <87y38iqti7.fsf@gmail.com> References: <20181221134829.29135.qmail@mail.muc.de> <20181221201106.GB16032@ACM> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1545439464 31793 195.159.176.226 (22 Dec 2018 00:44:24 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 22 Dec 2018 00:44:24 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: bea@klebe.blog, Stefan Monnier , 33794@debbugs.gnu.org To: Alan Mackenzie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Dec 22 01:44:20 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gaVOs-00087W-Pi for geb-bug-gnu-emacs@m.gmane.org; Sat, 22 Dec 2018 01:44:19 +0100 Original-Received: from localhost ([::1]:49096 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gaVQz-0002au-FV for geb-bug-gnu-emacs@m.gmane.org; Fri, 21 Dec 2018 19:46:29 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59514) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gaVQn-0002Xz-5k for bug-gnu-emacs@gnu.org; Fri, 21 Dec 2018 19:46:21 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gaVQd-0004qL-1T for bug-gnu-emacs@gnu.org; Fri, 21 Dec 2018 19:46:15 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:54743) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gaVQY-0004e5-Kl; Fri, 21 Dec 2018 19:46:05 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gaVQY-0007fg-9H; Fri, 21 Dec 2018 19:46:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Sat, 22 Dec 2018 00:46:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 33794 X-GNU-PR-Package: emacs,cc-mode X-GNU-PR-Keywords: Original-Received: via spool by 33794-submit@debbugs.gnu.org id=B33794.154543953329434 (code B ref 33794); Sat, 22 Dec 2018 00:46:02 +0000 Original-Received: (at 33794) by debbugs.gnu.org; 22 Dec 2018 00:45:33 +0000 Original-Received: from localhost ([127.0.0.1]:59001 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gaVQ5-0007ef-Bb for submit@debbugs.gnu.org; Fri, 21 Dec 2018 19:45:33 -0500 Original-Received: from mail-wm1-f48.google.com ([209.85.128.48]:54220) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gaVQ2-0007eR-4x for 33794@debbugs.gnu.org; Fri, 21 Dec 2018 19:45:31 -0500 Original-Received: by mail-wm1-f48.google.com with SMTP id d15so6773465wmb.3 for <33794@debbugs.gnu.org>; Fri, 21 Dec 2018 16:45:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=2upcAe+BT9CXXOap8s2uqLIgk1IS6JThU7tsnZMoWoo=; b=kcp3smW0a/h+XFiHMAsvOnEIGfiLHJH1+yGlvTHvVCoeyzfjRlseOd50mjxYn6exGI nYOX5BWxSOjbOVRxRUCqEy5v7YuhVlzRKxN34ou24iKfphqVjA6/yIWqfAB1LpRJhJn5 CcjCl+OeRdO4bsS/LCqc4jwYl7soVmIwkg+a20ilXeVzEn73frgpLZIjhnl1ztDgKBNN Q3hqo2mif/TIp8RPalwwjLoqQB/G2KMx6pzAN3XOfa/7SEeLWnJTG0RmN5TcAOAhr4y7 oJX3buyplPyHSqY9iTWHHMyKd+WZXQn8vSoxXpwV6l9cZZPJ3JKsCMchZnQ4MLMz1SLN 5IXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=2upcAe+BT9CXXOap8s2uqLIgk1IS6JThU7tsnZMoWoo=; b=kldh9ab94nntkCP7a/gaS/2lsnTh8ik9uqL+rqgvAClyinW6PcsPz9qk3XzMlVRU22 eRNG+dsDJe3TYWfvedV4gcKMHcmji2yy9gS5UVkTWnMyqSZvjhltp6yEubo18F3Yt2f2 P6ZgJ3WT6gFpSN7vo/3rwqYHfmWfNhzeXMjSLFyFU6pNKHCJbVKK0TjFCtrpZaUAh/6J 0XJBFE7IkA8D4o0XftNPAhWUEHbGlnX3I7w07ZuAXPYfA5FRAut9E1/Jnkh5MJhYYOmR tJCU3eY4EYsm9WAK1faBnswR3Z3hEMO7UEe1kuRjCz5NqgKbkOWzD4R6VQ5prrnR7pvv Srow== X-Gm-Message-State: AJcUukfSf4ATcMXyYpf2Jsl4hZlvKjzBvbnqOCJtm3WGOEPMtJrl8abZ kU5bgLpxBRkt/ZC7mX54wGHFO/6V X-Google-Smtp-Source: ALg8bN4tXZq+139xEJsgDOvyQfq/2DxiDXU3jML4M+XDC0bBPkvx0Sb2I3x0aumR/zKlfc/wXpVTkA== X-Received: by 2002:a7b:ce8e:: with SMTP id q14mr4922387wmj.10.1545439523973; Fri, 21 Dec 2018 16:45:23 -0800 (PST) Original-Received: from lolita.yourcompany.com (188.139.62.94.rev.vodafone.pt. [94.62.139.188]) by smtp.gmail.com with ESMTPSA id o8sm11723536wrx.15.2018.12.21.16.45.22 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 21 Dec 2018 16:45:23 -0800 (PST) In-Reply-To: <20181221201106.GB16032@ACM> (Alan Mackenzie's message of "Fri, 21 Dec 2018 20:11:06 +0000") 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: 208.118.235.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:153708 Archived-At: Hi Alan, I will be replying to the two emails you sent me in this single message. Alan Mackenzie writes: > No, not at all. CC Mode has been working for several decades, and works > well. electric-pair-mode is the new kid on the block, just a few years > old, and was apparently hacked together without regard to some well > established conventions. It should have provided interfaces to allow > existing software to connect to it - for example a variable to contain a > function to insert the electric character, or something like that. > Maybe. It should have been considered, but apparently wasn't. First, I think you'll agree that antiquity is a poor measure of the merits of software. Here's a characteristic of electric-pair-mode that I think is an actual merit: it works for every mode in Emacs.. Also, I don't know if you understand the history of electric-pair-mode. It has two generations: One, before 24.4, which I believe Stefan wrote, where it was a simpler mode to automatically insert parenthesis and quotes as described in electric-pair-pairs. Then, in 24.4, I borrowed code from my reasonably popular autopair.el extension and e-p-m became a mode that automatically infers what characters to pair from the syntax table of each mode. Furthermore, in the new version, it also makes educated guesses about when to pair or when not to pair based, again on the information collected from the buffer and its syntax table by syntax-ppss. The use of post-self-insert-hook was a requirement at the time, since that is how the pre-24.4 electric-pair-mode, electric-indent-mode and electric-layout-mode already worked. I welcomed this requirement, and it was what encouraged me to kill autopair.el and migrate to the new framework, since in autopair.el I had to rebind the parenthesis keys, which is akward (much like c-electric-brace and c-electric-paren are akward IMO). This simplified the code tremendously. So these "well established conventions" are, with all due respect, nothing more than personal opinions based on a narrow experience with a subset of modes (maybe "mode" singular), tried and tested as it may be. If I abandon the post-self-insert-hook convention for e-p-m, I'll probably be breaking the e-p-m interaction with electric-indent-mode, electric-layout-mode, etc. If there are existing problems with these interactions they should be fixed, but I will not fix e-p-m for interaction a specific part of cc-mode, unless you provide retro-compatible fix that guarantees existing behaviour outside cc-mode. I would rather declare e-p-m incompatible with that part of cc-mode and invest some time in providing alternatives based on electric-layout-mode, fixing Beatrix's problem by replacing bits of cc-mode-specific initialization in her init file with bits that works for all modes, including cc-mode. Jo=C3=A3o