From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Alan Mackenzie <acm@muc.de> Newsgroups: gmane.emacs.bugs Subject: bug#36539: elec-pair.elc gets surreptitiously loaded (almost) unconditionally at start up. Date: Sun, 7 Jul 2019 18:29:41 +0000 Message-ID: <20190707182941.GA4053@ACM> References: <20190707141414.GA5641@ACM> <87wogt3hqr.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="159104"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mutt/1.10.1 (2018-07-13) Cc: 36539@debbugs.gnu.org To: Noam Postavsky <npostavs@gmail.com> Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Jul 07 20:30:16 2019 Return-path: <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org> 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 <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org>) id 1hkBvU-000fCj-50 for geb-bug-gnu-emacs@m.gmane.org; Sun, 07 Jul 2019 20:30:16 +0200 Original-Received: from localhost ([::1]:36482 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org>) id 1hkBvO-0003GK-C5 for geb-bug-gnu-emacs@m.gmane.org; Sun, 07 Jul 2019 14:30:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37142) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1hkBvH-0003GC-Pg for bug-gnu-emacs@gnu.org; Sun, 07 Jul 2019 14:30:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1hkBvG-0003xL-KZ for bug-gnu-emacs@gnu.org; Sun, 07 Jul 2019 14:30:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:48573) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1hkBvG-0003wl-GM for bug-gnu-emacs@gnu.org; Sun, 07 Jul 2019 14:30:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1hkBvG-0003sS-8L for bug-gnu-emacs@gnu.org; Sun, 07 Jul 2019 14:30:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie <acm@muc.de> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org> Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 07 Jul 2019 18:30:02 +0000 Resent-Message-ID: <handler.36539.B36539.156252419014857@debbugs.gnu.org> Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 36539 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 36539-submit@debbugs.gnu.org id=B36539.156252419014857 (code B ref 36539); Sun, 07 Jul 2019 18:30:02 +0000 Original-Received: (at 36539) by debbugs.gnu.org; 7 Jul 2019 18:29:50 +0000 Original-Received: from localhost ([127.0.0.1]:57394 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>) id 1hkBv2-0003rY-Oy for submit@debbugs.gnu.org; Sun, 07 Jul 2019 14:29:50 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:36994 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from <acm@muc.de>) id 1hkBv0-0003rO-Tf for 36539@debbugs.gnu.org; Sun, 07 Jul 2019 14:29:47 -0400 Original-Received: (qmail 85530 invoked by uid 3782); 7 Jul 2019 18:29:42 -0000 Original-Received: from acm.muc.de (p2E5D59C3.dip0.t-ipconnect.de [46.93.89.195]) by colin.muc.de (tmda-ofmipd) with ESMTP; Sun, 07 Jul 2019 20:29:41 +0200 Original-Received: (qmail 23246 invoked by uid 1000); 7 Jul 2019 18:29:41 -0000 Content-Disposition: inline In-Reply-To: <87wogt3hqr.fsf@gmail.com> 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" <bug-gnu-emacs.gnu.org> List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-gnu-emacs>, <mailto:bug-gnu-emacs-request@gnu.org?subject=unsubscribe> List-Archive: <https://lists.gnu.org/archive/html/bug-gnu-emacs> List-Post: <mailto:bug-gnu-emacs@gnu.org> List-Help: <mailto:bug-gnu-emacs-request@gnu.org?subject=help> List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-gnu-emacs>, <mailto:bug-gnu-emacs-request@gnu.org?subject=subscribe> Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org> Xref: news.gmane.org gmane.emacs.bugs:162294 Archived-At: <http://permalink.gmane.org/gmane.emacs.bugs/162294> Hello, Noam. On Sun, Jul 07, 2019 at 12:57:16 -0400, Noam Postavsky wrote: > tags 36539 + patch > quit > Alan Mackenzie <acm@muc.de> writes: > > A decision should be taken as to whether elec-pair.elc should be loaded > > at start up, and if so, it should be part of the dump. If not, the > > `require' form in elisp-mode.el should be replaced by an > > `eval-after-load' form. > I think it's clear that elec-pair should not be part of the dump, since > electric-pair-mode is not turned on by default. Looking at the git log, > it seems I added the require to avoid some bootstrapping problems with > Bug#24901, but we can move the electric-pair-text-pairs manipulation to > a hook instead: Just as a matter of interest, I commented out the pertinent form in emacs-lisp-mode, did a make bootstrap, emacs -Q, and elec-pair.elc was still present in my Emacs. :-( I don't know why, or how, but it is. With your patch (below), have you tested whether or not elec-pair.elc hasn't been loaded on starting Emacs? If it hasn't been loaded, you've found some trick that eludes me. > >>From cf6057cb5bf6a44d718349776e370b225bc7079f Mon Sep 17 00:00:00 2001 > From: Noam Postavsky <npostavs@gmail.com> > Date: Sun, 7 Jul 2019 12:22:37 -0400 > Subject: [PATCH] Don't load elec-pair in elisp-mode (Bug#36539) > > * lisp/progmodes/elisp-mode.el (emacs-lisp-set-electric-text-pairs): > New function. > (emacs-lisp-mode): Add it to electric-pair-mode-hook. > --- > lisp/progmodes/elisp-mode.el | 14 ++++++++------ > 1 file changed, 8 insertions(+), 6 deletions(-) > > diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el > index c86277a309..7c77c34b50 100644 > --- a/lisp/progmodes/elisp-mode.el > +++ b/lisp/progmodes/elisp-mode.el > @@ -233,6 +233,12 @@ emacs-lisp-mode-hook > :type 'hook > :group 'lisp) > > +(defun emacs-lisp-set-electric-text-pairs () > + (defvar electric-pair-text-pairs) > + (setq-local electric-pair-text-pairs > + (append '((?\` . ?\') (?‘ . ?’)) electric-pair-text-pairs)) > + (remove-hook 'electric-pair-mode-hook #'emacs-lisp-set-electric-text-pairs t)) > + > ;;;###autoload > (define-derived-mode emacs-lisp-mode prog-mode "Emacs-Lisp" > "Major mode for editing Lisp code to run in Emacs. > @@ -245,12 +251,8 @@ emacs-lisp-mode > (defvar project-vc-external-roots-function) > (lisp-mode-variables nil nil 'elisp) > (add-hook 'after-load-functions #'elisp--font-lock-flush-elisp-buffers) > - (unless noninteractive > - (require 'elec-pair) > - (defvar electric-pair-text-pairs) > - (setq-local electric-pair-text-pairs > - (append '((?\` . ?\') (?‘ . ?’)) electric-pair-text-pairs)) > - (setq-local electric-quote-string t)) > + (add-hook 'electric-pair-mode-hook #'emacs-lisp-set-electric-text-pairs t) Shouldn't that be .....-text pairs nil t), to make a local value of the ^^^ hook? The remove-hook (above) seems to be expecting a local value. > + (setq-local electric-quote-string t) > (setq imenu-case-fold-search nil) > (add-function :before-until (local 'eldoc-documentation-function) > #'elisp-eldoc-documentation-function) > -- > 2.11.0 > As a matter of interest, what is that 2.11.0 that I keep seeing at the bottom of patches? -- Alan Mackenzie (Nuremberg, Germany).