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 14:47:51 -0400
Message-ID: <87tvbx3cmg.fsf@gmail.com>
References: <20190707141414.GA5641@ACM> <87wogt3hqr.fsf@gmail.com>
 <20190707182941.GA4053@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="237484"; 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 20:49:10 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 1hkCDl-000zfK-NP
	for geb-bug-gnu-emacs@m.gmane.org; Sun, 07 Jul 2019 20:49:09 +0200
Original-Received: from localhost ([::1]:36572 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 1hkCDk-0007CQ-Pf
	for geb-bug-gnu-emacs@m.gmane.org; Sun, 07 Jul 2019 14:49:08 -0400
Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40973)
 by lists.gnu.org with esmtp (Exim 4.86_2)
 (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1hkCDf-0007CJ-SZ
 for bug-gnu-emacs@gnu.org; Sun, 07 Jul 2019 14:49: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 1hkCDe-00020W-Pg
 for bug-gnu-emacs@gnu.org; Sun, 07 Jul 2019 14:49:03 -0400
Original-Received: from debbugs.gnu.org ([209.51.188.43]:48582)
 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 1hkCDe-0001zr-Gf
 for bug-gnu-emacs@gnu.org; Sun, 07 Jul 2019 14:49: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 1hkCDe-0004Mq-Dk
 for bug-gnu-emacs@gnu.org; Sun, 07 Jul 2019 14:49:02 -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 18:49:02 +0000
Resent-Message-ID: <handler.36539.B36539.156252528216704@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.156252528216704
 (code B ref 36539); Sun, 07 Jul 2019 18:49:02 +0000
Original-Received: (at 36539) by debbugs.gnu.org; 7 Jul 2019 18:48:02 +0000
Original-Received: from localhost ([127.0.0.1]:57403 helo=debbugs.gnu.org)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
 id 1hkCCf-0004LA-62
 for submit@debbugs.gnu.org; Sun, 07 Jul 2019 14:48:02 -0400
Original-Received: from mail-io1-f51.google.com ([209.85.166.51]:35137)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <npostavs@gmail.com>) id 1hkCCc-0004Kx-M1
 for 36539@debbugs.gnu.org; Sun, 07 Jul 2019 14:47:59 -0400
Original-Received: by mail-io1-f51.google.com with SMTP id m24so20559381ioo.2
 for <36539@debbugs.gnu.org>; Sun, 07 Jul 2019 11:47:58 -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=Sr7GPqETeMuy+LCjOdruUsQPQkrN9Vyv5SYC1pdkrNc=;
 b=IT8n5KlVVtqrTEroyb9qiSCseXJZr9gBuc/MV361UfUXbiS72NxsUH2xrBtvCXg9Pd
 XIHr3My/kFkTpzHpKVWBi1wPVKp8p/kePsEZNnOXb+vbckEXrQriusQ37Y1pE6SYh/0R
 jnzKh8JobW6eP+fBHVMrOXzd6/8qA1j8VtFfZWN6IJ3DmYH3jbaE+YfNsv8lelGViRyR
 YIdwRBH7OxSVO3Wu6bxKjC9SPLiIcFANQ1cScNgSNLaf47om2VuRBj+y2gpxSDN0EU6L
 WUu0mPIxjpwjwG826yJLm4suk6xqkYe7QY033kFMlHn2ybYOXTdf7MXLUJ6swWm88kmo
 uAlQ==
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=Sr7GPqETeMuy+LCjOdruUsQPQkrN9Vyv5SYC1pdkrNc=;
 b=s0uPb/QAGsNZdR0iFT0Xzbo2H0lABECrrV9fRZYNLK2E48at7Cd8h4ie4H11TENhE+
 /BlHi9x3Mr1fxMmUwnD1htfX9TXJ0oxX1Pjwc5eQ+bjo+es7k1iXrk0LlD4kSSLJFQJ7
 RdGj0oH875EzBPeluKacjzzD9lUhEQXuibzmKDYwQ8OOjjX9ZzpoNkT6ZZ93Oalt69pa
 eTGVzBzlvZqPY2+i7ccCnXNkxnKyraAaPTUPC8nsA09tjfDvjzMqRdD91Ibfqyj5J5Wo
 w7UP2pQwCocMuXI67X7RMSkGfPOGZ/Cf0VD16SHptde4xUflRg319n2gOvBsBcnXxJGs
 3FVw==
X-Gm-Message-State: APjAAAXa17NjtNKAIW43szB+6yyYeAS6mKpBCY8PQgTFOlpzJVeSCKye
 zsbUfShQ+tpUj+RAcHReY35APS7c
X-Google-Smtp-Source: APXvYqy8Pbsedo03UxPDj0WrG77S0j4jQY1ODWcIiACaFmx0hasS0jlr8r11MLrXWKS/MJZfZABxeg==
X-Received: by 2002:a5d:8ad0:: with SMTP id e16mr9255243iot.262.1562525272699; 
 Sun, 07 Jul 2019 11:47:52 -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
 h19sm10993429iol.65.2019.07.07.11.47.52
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Sun, 07 Jul 2019 11:47:52 -0700 (PDT)
In-Reply-To: <20190707182941.GA4053@ACM> (Alan Mackenzie's message of "Sun, 7
 Jul 2019 18:29:41 +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:162296
Archived-At: <http://permalink.gmane.org/gmane.emacs.bugs/162296>

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

Alan Mackenzie <acm@muc.de> writes:

> 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.

How are you checking?  M-: (featurep 'elec-pair) RET returns nil for me.

Assuming you have help-enable-completion-auto-load set to t (the
default), it's pretty easy to load various things just by hitting TAB in
response to describe-function or describe-variable.

>> +  (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.

Oops, yes, thanks for catching that.

>> +  (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?

Looks like 'git format-patch' adds the git version at the bottom.

$ git --version
git version 2.11.0


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

>From c3a99c7260e07692c8d02a9cd9d38f6ef188311c 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..78a87f2d32 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 =
nil 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


--=-=-=--