From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail
From: Noam Postavsky <npostavs@gmail.com>
Newsgroups: gmane.emacs.bugs
Subject: bug#36539: elec-pair.elc gets surreptitiously loaded (almost)
 unconditionally at start up.
Date: Sun, 07 Jul 2019 12:57:16 -0400
Message-ID: <87wogt3hqr.fsf@gmail.com>
References: <20190707141414.GA5641@ACM>
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226";
	logging-data="66088"; mail-complaints-to="usenet@blaine.gmane.org"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2.90 (gnu/linux)
Cc: 36539@debbugs.gnu.org
To: Alan Mackenzie <acm@muc.de>
Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Jul 07 18:58:12 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 1hkAUL-000H40-3J
	for geb-bug-gnu-emacs@m.gmane.org; Sun, 07 Jul 2019 18:58:09 +0200
Original-Received: from localhost ([::1]:36282 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 1hkAUK-0008TB-5u
	for geb-bug-gnu-emacs@m.gmane.org; Sun, 07 Jul 2019 12:58:08 -0400
Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48335)
 by lists.gnu.org with esmtp (Exim 4.86_2)
 (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1hkAUF-0008Sv-BQ
 for bug-gnu-emacs@gnu.org; Sun, 07 Jul 2019 12:58:04 -0400
Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1hkAUE-000812-6A
 for bug-gnu-emacs@gnu.org; Sun, 07 Jul 2019 12:58:03 -0400
Original-Received: from debbugs.gnu.org ([209.51.188.43]:48538)
 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 1hkAUD-00080f-TN
 for bug-gnu-emacs@gnu.org; Sun, 07 Jul 2019 12:58: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 1hkAUD-0007wG-PY
 for bug-gnu-emacs@gnu.org; Sun, 07 Jul 2019 12:58:01 -0400
X-Loop: help-debbugs@gnu.org
Resent-From: Noam Postavsky <npostavs@gmail.com>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@gnu.org
Resent-Date: Sun, 07 Jul 2019 16:58:01 +0000
Resent-Message-ID: <handler.36539.B36539.156251864930466@debbugs.gnu.org>
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 36539
X-GNU-PR-Package: emacs
Original-Received: via spool by 36539-submit@debbugs.gnu.org id=B36539.156251864930466
 (code B ref 36539); Sun, 07 Jul 2019 16:58:01 +0000
Original-Received: (at 36539) by debbugs.gnu.org; 7 Jul 2019 16:57:29 +0000
Original-Received: from localhost ([127.0.0.1]:57359 helo=debbugs.gnu.org)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
 id 1hkATg-0007vK-J4
 for submit@debbugs.gnu.org; Sun, 07 Jul 2019 12:57:28 -0400
Original-Received: from mail-io1-f43.google.com ([209.85.166.43]:40116)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <npostavs@gmail.com>)
 id 1hkATb-0007us-HL; Sun, 07 Jul 2019 12:57:24 -0400
Original-Received: by mail-io1-f43.google.com with SMTP id h6so21389673iom.7;
 Sun, 07 Jul 2019 09:57:23 -0700 (PDT)
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;
 bh=CTN9JeGxZXaXi4KY6mMYgzXbBYwgnOYHVwYdd23AElc=;
 b=gUhVd/udcFYt5M8m//3Og+nRcQX3J/gdaa1lj4E4ewKLFNQPNOPl3h6GWpB59PZpAr
 cMN+DBYhVUsndeOKE+RU6Fq8eyOAJT1rIaCzegiodhBgAFcWy0XhLZatLVHuM0BJTsIO
 DTA2cYAtXZB4uEMtCOqkOjEId7AveYhDmitRlWONFdsyRH3Cl8pNB/beOxust4mAWisv
 ddbQxq1tgOKSNs6PhKoy/6R21HNbkoCqtX9T7CZwVxiZsMUW7O7fu0xpiIThbYCGc6FV
 CH8/KCv7AdfXbbzx+UT8h4WKRApdCeiI2O2Av2Up1rFwPmaFz7K+Yh0VHsy5//eAxv4I
 MDOw==
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;
 bh=CTN9JeGxZXaXi4KY6mMYgzXbBYwgnOYHVwYdd23AElc=;
 b=F5FPki9e41V0IGjL5zJGB3pNm488+b7r8wCbSRfghBsFOp2Q9ii/0+VMbSN6SytlSX
 4BpokKIk1yxZThbpcteFEe88qwniJwjghUX/wy+KYcwP8WkzU4zePYs77UTgRZoaeuZm
 nxK55df0jdNaK2+1inwIIu0hTglhmzwQmv7mHaG+MO5QfHFe9MPGWZcOPPTwVvj3ulcQ
 n/8TyAK3w39KpCXs1ugSm005KIF0rSncd7cLolmAyTdh2szQOHXz3SkXFI0ny1U5Alxr
 A1AubUOH3QACMykwCCw4IhdjeGIEd315bm5nLhh1TGhNqFYCpDJDoPPa+nYWbBRMgORL
 VjBg==
X-Gm-Message-State: APjAAAWX7duionjVUgIvgId3wdj1v4Jx6w25ErIBKNFfgZcQ0i3QxQ5V
 RAP536t+d8PEYL2MzMlnE7UcCgRI
X-Google-Smtp-Source: APXvYqwwzBXDQq6mKEZzmvtPCplDh5hL8CJ1pCTZlExcelicoR7IHLAnzlqYA6SxQjoHkTZYZAj3Ig==
X-Received: by 2002:a5d:9e49:: with SMTP id i9mr14621247ioi.290.1562518637751; 
 Sun, 07 Jul 2019 09:57:17 -0700 (PDT)
Original-Received: from minid (cbl-45-2-119-34.yyz.frontiernetworks.ca. [45.2.119.34])
 by smtp.gmail.com with ESMTPSA id
 n2sm5223383ioa.27.2019.07.07.09.57.16
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Sun, 07 Jul 2019 09:57:17 -0700 (PDT)
In-Reply-To: <20190707141414.GA5641@ACM> (Alan Mackenzie's message of "Sun, 7
 Jul 2019 14:14:14 +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: 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:162291
Archived-At: <http://permalink.gmane.org/gmane.emacs.bugs/162291>

--=-=-=
Content-Type: text/plain

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:


--=-=-=
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: inline;
 filename=0001-Don-t-load-elec-pair-in-elisp-mode-Bug-36539.patch
Content-Transfer-Encoding: quoted-printable
Content-Description: patch

>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)
=20
+(defun emacs-lisp-set-electric-text-pairs ()
+  (defvar electric-pair-text-pairs)
+  (setq-local electric-pair-text-pairs
+              (append '((?\` . ?\') (?=E2=80=98 . ?=E2=80=99)) electric-pa=
ir-text-pairs))
+  (remove-hook 'electric-pair-mode-hook #'emacs-lisp-set-electric-text-pai=
rs 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 '((?\` . ?\') (?=E2=80=98 . ?=E2=80=99)) electric-=
pair-text-pairs))
-    (setq-local electric-quote-string t))
+  (add-hook 'electric-pair-mode-hook #'emacs-lisp-set-electric-text-pairs =
t)
+  (setq-local electric-quote-string t)
   (setq imenu-case-fold-search nil)
   (add-function :before-until (local 'eldoc-documentation-function)
                 #'elisp-eldoc-documentation-function)
--=20
2.11.0


--=-=-=--