From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: joaotavora@gmail.com (=?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?=) Newsgroups: gmane.emacs.bugs Subject: bug#24901: Caught mistake in elec-pair.el patch Date: Thu, 17 Aug 2017 16:36:19 +0100 Message-ID: <87valm1a18.fsf@lolita> References: <871soaz810.fsf@users.sourceforge.net> <8360dmff2n.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1502984246 23674 195.159.176.226 (17 Aug 2017 15:37:26 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 17 Aug 2017 15:37:26 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) Cc: 24901@debbugs.gnu.org, npostavs@users.sourceforge.net, rrt@sc3d.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Aug 17 17:37:21 2017 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 1diMrE-0005cl-7S for geb-bug-gnu-emacs@m.gmane.org; Thu, 17 Aug 2017 17:37:16 +0200 Original-Received: from localhost ([::1]:59229 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1diMrK-0007wU-E3 for geb-bug-gnu-emacs@m.gmane.org; Thu, 17 Aug 2017 11:37:22 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57095) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1diMr6-0007ui-My for bug-gnu-emacs@gnu.org; Thu, 17 Aug 2017 11:37:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1diMr0-0003r5-NR for bug-gnu-emacs@gnu.org; Thu, 17 Aug 2017 11:37:08 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:34288) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1diMr0-0003qk-Is for bug-gnu-emacs@gnu.org; Thu, 17 Aug 2017 11:37:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1diMr0-00016J-As for bug-gnu-emacs@gnu.org; Thu, 17 Aug 2017 11:37:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: joaotavora@gmail.com (=?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?=) Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 17 Aug 2017 15:37:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24901 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 24901-submit@debbugs.gnu.org id=B24901.15029841924189 (code B ref 24901); Thu, 17 Aug 2017 15:37:02 +0000 Original-Received: (at 24901) by debbugs.gnu.org; 17 Aug 2017 15:36:32 +0000 Original-Received: from localhost ([127.0.0.1]:42969 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1diMqV-00015V-V0 for submit@debbugs.gnu.org; Thu, 17 Aug 2017 11:36:32 -0400 Original-Received: from mail-wr0-f177.google.com ([209.85.128.177]:36332) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1diMqU-00015G-I0 for 24901@debbugs.gnu.org; Thu, 17 Aug 2017 11:36:30 -0400 Original-Received: by mail-wr0-f177.google.com with SMTP id f8so2548912wrf.3 for <24901@debbugs.gnu.org>; Thu, 17 Aug 2017 08:36:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:in-reply-to:references:user-agent:date :message-id:mime-version; bh=Yq5AR5CdWZcETXjwE5FiMKF1xZ16Xa45qIgXHxBcbcA=; b=inSPr1T8dM4daaOWmTzhGSBSQmnGEhWKiXF8JBX5F2Gsw9k2MuTIY2kz4IiuAYYIgF V1ddut5Lt5fdTlTNW4N7w84SSUpki5TLunEbYA0+ZpJ1CwLjdPiaMrOPopy2iCNw8KqQ eHwI8WA9SzJkGLl59L4LaPCbradQ+QILul4j0GSOIKj7OjGYxbzQ8nWiLjBDSOq+fXuz ZPCf6BsNygdEx2+4Ia9LU+fG0RHeyKc/xrWqIeBoyITzQJgj28fAxyVa2dhVcsG784np 9CrixlrfdqxUt68SKn43DtRKprfVDiBlda0uPhVT2vgolASFpb3RL6eza6eo8c7VH7sA PQVQ== 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:in-reply-to:references :user-agent:date:message-id:mime-version; bh=Yq5AR5CdWZcETXjwE5FiMKF1xZ16Xa45qIgXHxBcbcA=; b=EfBLf9HkQNX640EImQC1W+0HB2FqfvhSVQm1gqtbldhm/oDmLfYkgc652zNU7tAEwK pUZywuCsms1a1sjcx4JfRCLlONmpfjsJr3LPzN5euOdDCVjeOX8ZjiBVSxJeoOmYjwoc qRTUXWd6OD9c0bq+3LVrY9WSPnZb9+jbmPtBdLVOkoJRifcV9u3/YXSfE+PVMuj1kTEz PM45tSN1PMIQM2jA6fyyigeY+xyDsvB4SKS8mwcQgm9COLxwd/KizFqboCZ9tfhiZj/l AhU4ry+CoGfGqEB+0GOJMjAP4KJ6gxIWi/vbScOuZnqor+d5+N+qrqVyX1YdLOrPA4nG 8DHg== X-Gm-Message-State: AHYfb5isdZm3PzyLCxYHvqrl1iJDMVgT/Cg+AtKDuNEcI4DQPepXhEcZ bcNmc8HLt7eb6R+WuCE= X-Received: by 10.28.24.83 with SMTP id 80mr1416391wmy.86.1502984184315; Thu, 17 Aug 2017 08:36:24 -0700 (PDT) Original-Received: from lolita.yourcompany.com (190.159.62.94.rev.vodafone.pt. [94.62.159.190]) by smtp.gmail.com with ESMTPSA id v17sm3028108wrg.24.2017.08.17.08.36.21 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 17 Aug 2017 08:36:22 -0700 (PDT) In-Reply-To: <8360dmff2n.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 17 Aug 2017 17:23:44 +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: 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:135874 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Eli Zaretskii writes: >> From: Jo=C3=A3o T=C3=A1vora >> Date: Thu, 17 Aug 2017 14:32:08 +0100 >> Cc: Reuben Thomas , 24901@debbugs.gnu.org, Eli Zaretskii <= eliz@gnu.org> >>=20 >> On Thu, Aug 17, 2017 at 1:35 PM, wrote: >>=20 >> > Or remove the autoload from electric-pair-text-pairs? >>=20 >> Seems to be there for a reason, unfortunately. It's forward=20 >> referenced in electric.el if I'm not mistaken. > > I don't understand this: electric.el is preloaded, so why would it > need the autoload? I don't know, I admit I'm very confused by the autoload logic, so you lost me at preloaded. Also have been away from Elisp for almost a year. If I remove the autoload I get compilation errors in electric.elc or align.elc (from make bootstrap). I might be doing something wrong. How can I test the autoload dependecies without a full make bootstrap? And then there's the problem Noam mentioned in elisp-mode.el. But Noam's patch apparently fixes that, so here's his patch and mine for a quick review from either of you if you don't mind. Tested with 'make bootstrap'. Thanks, Jo=C3=A3o --=-=-= Content-Type: text/x-diff; charset=utf-8 Content-Disposition: inline; filename=0001-lisp-elec-pair.el-electric-pair-text-pairs-Don-t-aut.patch Content-Transfer-Encoding: quoted-printable >From 3e5a166cb7e5b575252c5c69c2678d2074d58c12 Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Thu, 17 Aug 2017 07:06:47 -0400 Subject: [PATCH 1/2] * lisp/elec-pair.el (electric-pair-text-pairs): Don't autoload (Bug#24901). * lisp/progmodes/elisp-mode.el (emacs-lisp-mode): Require `elec-pair' explicitly in the interactive case. --- lisp/elec-pair.el | 1 - lisp/progmodes/elisp-mode.el | 9 ++++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lisp/elec-pair.el b/lisp/elec-pair.el index 87e82e24fb..f990851185 100644 --- a/lisp/elec-pair.el +++ b/lisp/elec-pair.el @@ -42,7 +42,6 @@ electric-pair-pairs :group 'electricity :type '(repeat (cons character character))) =20 -;;;###autoload (defcustom electric-pair-text-pairs '((?\" . ?\" ) ((nth 0 electric-quote-chars) . (nth 1 electric-quote-chars)) diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el index 47739f5957..0bf8857960 100644 --- a/lisp/progmodes/elisp-mode.el +++ b/lisp/progmodes/elisp-mode.el @@ -231,9 +231,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) - (setq-local electric-pair-text-pairs - (append '((?\` . ?\') (?=E2=80=98 . ?=E2=80=99)) electric-pa= ir-text-pairs)) - (setq-local electric-quote-string t) + (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)) (setq imenu-case-fold-search nil) (add-function :before-until (local 'eldoc-documentation-function) #'elisp-eldoc-documentation-function) --=20 2.11.0 --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0002-Fix-default-value-of-electric-pair-pairs-and-electri.patch >From a96f9ed05edfe619f7bc4edf5485c937e3df4d1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20T=C3=A1vora?= Date: Thu, 17 Aug 2017 10:44:38 +0100 Subject: [PATCH 2/2] Fix default value of electric-pair-pairs and electric-pair-text-pairs Fixes: debbugs:24901 A previous change, titled "Add support for curly quotation marks to electric-pair-mode", attempted to add these characters to the default value of these variables. But it did so in a quoted list, preventing evaluation of the relevant expressions and resulting in an invalid format. * lisp/elec-pair.el (electric-pair-pairs): Use backquote and comma. (electric-pair-text-pairs): Use backquote and comma. --- lisp/elec-pair.el | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lisp/elec-pair.el b/lisp/elec-pair.el index f990851185..236f5f1283 100644 --- a/lisp/elec-pair.el +++ b/lisp/elec-pair.el @@ -28,9 +28,9 @@ ;;; Electric pairing. (defcustom electric-pair-pairs - '((?\" . ?\") - ((nth 0 electric-quote-chars) . (nth 1 electric-quote-chars)) - ((nth 2 electric-quote-chars) . (nth 3 electric-quote-chars))) + `((?\" . ?\") + (,(nth 0 electric-quote-chars) . ,(nth 1 electric-quote-chars)) + (,(nth 2 electric-quote-chars) . ,(nth 3 electric-quote-chars))) "Alist of pairs that should be used regardless of major mode. Pairs of delimiters in this list are a fallback in case they have @@ -43,9 +43,9 @@ electric-pair-pairs :type '(repeat (cons character character))) (defcustom electric-pair-text-pairs - '((?\" . ?\" ) - ((nth 0 electric-quote-chars) . (nth 1 electric-quote-chars)) - ((nth 2 electric-quote-chars) . (nth 3 electric-quote-chars))) + `((?\" . ?\" ) + (,(nth 0 electric-quote-chars) . ,(nth 1 electric-quote-chars)) + (,(nth 2 electric-quote-chars) . ,(nth 3 electric-quote-chars))) "Alist of pairs that should always be used in comments and strings. Pairs of delimiters in this list are a fallback in case they have -- 2.11.0 --=-=-=--