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: Sat, 13 Jul 2019 18:41:23 -0400 Message-ID: <87o91x1rsc.fsf@gmail.com> References: <20190707141414.GA5641@ACM> <87wogt3hqr.fsf@gmail.com> <20190707182941.GA4053@ACM> <87tvbx3cmg.fsf@gmail.com> <20190707191052.GB4053@ACM> <835zo6175r.fsf@gnu.org> 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="189052"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2.90 (gnu/linux) Cc: Alan Mackenzie <acm@muc.de>, 36539@debbugs.gnu.org To: Eli Zaretskii <eliz@gnu.org> Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Jul 14 00:42:09 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 1hmQiX-000n4V-J8 for geb-bug-gnu-emacs@m.gmane.org; Sun, 14 Jul 2019 00:42:09 +0200 Original-Received: from localhost ([::1]:58272 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 1hmQiV-0001eD-87 for geb-bug-gnu-emacs@m.gmane.org; Sat, 13 Jul 2019 18:42:07 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38785) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1hmQiR-0001ch-Jc for bug-gnu-emacs@gnu.org; Sat, 13 Jul 2019 18:42: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 1hmQiQ-00017O-GD for bug-gnu-emacs@gnu.org; Sat, 13 Jul 2019 18:42:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:34731) 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 1hmQiQ-00017K-CH for bug-gnu-emacs@gnu.org; Sat, 13 Jul 2019 18:42: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 1hmQiQ-0000ld-6R for bug-gnu-emacs@gnu.org; Sat, 13 Jul 2019 18:42: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: Sat, 13 Jul 2019 22:42:02 +0000 Resent-Message-ID: <handler.36539.B36539.15630576922905@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.15630576922905 (code B ref 36539); Sat, 13 Jul 2019 22:42:02 +0000 Original-Received: (at 36539) by debbugs.gnu.org; 13 Jul 2019 22:41:32 +0000 Original-Received: from localhost ([127.0.0.1]:43552 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>) id 1hmQhw-0000kn-3W for submit@debbugs.gnu.org; Sat, 13 Jul 2019 18:41:32 -0400 Original-Received: from mail-io1-f43.google.com ([209.85.166.43]:42992) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <npostavs@gmail.com>) id 1hmQhv-0000kb-00 for 36539@debbugs.gnu.org; Sat, 13 Jul 2019 18:41:31 -0400 Original-Received: by mail-io1-f43.google.com with SMTP id u19so27942775ior.9 for <36539@debbugs.gnu.org>; Sat, 13 Jul 2019 15:41:30 -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=gNB0WaBI1rXx8OOOI0VINDBfUWqifwaQw3umovtbk54=; b=Y9ldMVLFBzYzaGhFJ0tCZUJzDjV+l1hTfzdyVo97U6izyy0qohdjKcihEcXWuEGHS5 EeALSOGin6YFP/vW4MNLkIowUCiVOS0LGwB+NA4aYyJ93uvAvLzC0WBpMDJuLgbDYqcu s43laGyDUvJ2JO2w8UgMfDwvwP4D/Gzlg3EWEUB5WubkM+TJKhOdp1f5gbopy+9b2ew9 Ltw9Otd0ndFp3CKyvCvqKQtXP7IVtHAaO5Pefb48Itpgd38MR0hdLsNMQEBVuJIaqm4v 48JywhSqRKP8BUSZqvK6aJv6XBa1XH2L69NRlIxb47qbD+nrWrczykjhkZ2AHTkmwjDA xpgw== 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=gNB0WaBI1rXx8OOOI0VINDBfUWqifwaQw3umovtbk54=; b=UV1s1RS4o//bO/bYxGgMi4mAScsFMPCpCd+8fcZH36bf3KaMURrgAZTUWBmyBF1gg/ FJutvrIir9Dsh+KVwb/puITU+gMmBn0992rCIb/LrtuiY6vHj92qsa9Qh/QzQE27nAY4 gNDIbrVHKiHFR5f27tjxDX55DA0quJQs6thCwM8JvUvVzxd16iT9q+CU2tnHK/BYIUJE CKmOOb5EBI5m9pod5yiHhgQtIhFOirTMYQ7L4+c0m1U1seoye3/9tB8MLjIIJvubO/Eg /6b/ZQv3EWSpW/rM9GaOvsEekqmhBWTnLqTgfQehBX5GPpcDU3/Z2RHXK7pCqWSgU6Gy Hk/w== X-Gm-Message-State: APjAAAWQAYUI8h3Cf7GP6U179QdBizndkcUeOMs9ixDE6bhIorXZdAXU nT2Fmay2wgqQen7A1XakpwxQAuEr X-Google-Smtp-Source: APXvYqwUPMNOoAalZ/G9AyQ0a/7Jm3qsjsTpo3CIFkgF1nZTwHoqHMaK/MJT5zvfYx8kLU3guqFpGA== X-Received: by 2002:a5e:9e42:: with SMTP id j2mr18634481ioq.133.1563057685243; Sat, 13 Jul 2019 15:41:25 -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 k26sm9817074ios.38.2019.07.13.15.41.24 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 13 Jul 2019 15:41:24 -0700 (PDT) In-Reply-To: <835zo6175r.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 13 Jul 2019 14:54:40 +0300") 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:162943 Archived-At: <http://permalink.gmane.org/gmane.emacs.bugs/162943> --=-=-= Content-Type: text/plain Eli Zaretskii <eliz@gnu.org> writes: > Any reasons this is not yet installed on master? Actually, I noticed a problem with it: electric-pair-mode is a global mode, so using the local value of the hook isn't right. I think the updated patch below is correct. --=-=-= 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 ebec942f5734f2ce6916dc14706704dc1a93e62d 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, if elec-pair hasn't been loaded yet. --- lisp/progmodes/elisp-mode.el | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el index c86277a309..5204c78131 100644 --- a/lisp/progmodes/elisp-mode.el +++ b/lisp/progmodes/elisp-mode.el @@ -233,6 +233,17 @@ emacs-lisp-mode-hook :type 'hook :group 'lisp) =20 +(defun emacs-lisp-set-electric-text-pairs () + (defvar electric-pair-text-pairs) + (let ((elisp-pairs (append '((?\` . ?\') (?=E2=80=98 . ?=E2=80=99)) + electric-pair-text-pairs))) + (save-current-buffer + (dolist (buf (buffer-list)) + (set-buffer buf) + (when (derived-mode-p 'emacs-lisp-mode) + (setq-local electric-pair-text-pairs elisp-pairs))))) + (remove-hook 'electric-pair-mode-hook #'emacs-lisp-set-electric-text-pai= rs)) + ;;;###autoload (define-derived-mode emacs-lisp-mode prog-mode "Emacs-Lisp" "Major mode for editing Lisp code to run in Emacs. @@ -245,12 +256,12 @@ 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)) + (if (boundp 'electric-pair-text-pairs) + (setq-local electric-pair-text-pairs + (append '((?\` . ?\') (?=E2=80=98 . ?=E2=80=99)) + electric-pair-text-pairs)) + (add-hook 'electric-pair-mode-hook #'emacs-lisp-set-electric-text-pair= s)) + (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 --=-=-=--