From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: =?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 11:32:10 +0100 Message-ID: References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="94eb2c058ea4970c360556f087d0" X-Trace: blaine.gmane.org 1502966002 19420 195.159.176.226 (17 Aug 2017 10:33:22 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 17 Aug 2017 10:33:22 +0000 (UTC) Cc: 24901@debbugs.gnu.org To: Reuben Thomas Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Aug 17 12:33:17 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 1diI6w-0004Iq-G5 for geb-bug-gnu-emacs@m.gmane.org; Thu, 17 Aug 2017 12:33:10 +0200 Original-Received: from localhost ([::1]:43719 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1diI6z-00015K-Ik for geb-bug-gnu-emacs@m.gmane.org; Thu, 17 Aug 2017 06:33:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35771) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1diI6s-00014K-1C for bug-gnu-emacs@gnu.org; Thu, 17 Aug 2017 06:33:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1diI6o-0001Py-PO for bug-gnu-emacs@gnu.org; Thu, 17 Aug 2017 06:33:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:33344) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1diI6o-0001Pr-Lz for bug-gnu-emacs@gnu.org; Thu, 17 Aug 2017 06:33:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1diI6o-0000A2-AR for bug-gnu-emacs@gnu.org; Thu, 17 Aug 2017 06:33:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: =?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 10:33: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.1502965959589 (code B ref 24901); Thu, 17 Aug 2017 10:33:02 +0000 Original-Received: (at 24901) by debbugs.gnu.org; 17 Aug 2017 10:32:39 +0000 Original-Received: from localhost ([127.0.0.1]:42025 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1diI6Q-00009Q-UQ for submit@debbugs.gnu.org; Thu, 17 Aug 2017 06:32:39 -0400 Original-Received: from mail-qk0-f181.google.com ([209.85.220.181]:38549) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1diI6O-00009D-WC for 24901@debbugs.gnu.org; Thu, 17 Aug 2017 06:32:37 -0400 Original-Received: by mail-qk0-f181.google.com with SMTP id x191so34063683qka.5 for <24901@debbugs.gnu.org>; Thu, 17 Aug 2017 03:32:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=KDAfJYq5RKv17QGPQtW+0ytgCKvypNcMoXqEI7x1pO0=; b=sYipyV5fiGG9vDHpcc6IUMFRoj4iYCnUWA9gdBqQDI7PQaaDXpbloH40GzLRQfkYoN yBDdWBw2DxmREo+c9n43A33y0d630yADaWQK9cuuRAUHApmFCOZme/f6uJfXV35Qpdxh 7GVk/LXjIpFeokeZfewhPb2EMyfGBel6Pn8TPKNx0MmELHfjSO7eIkNANNWe82NWF67g dSqQIuUFjpw2kbWaVwIxKPFdwxgkbj1lj4o1ZliASMRFLitzIqxsxQaqtaPV1dqlGdcs LINxfLtU3T0Eu05cbgmPTn3+TQHrxY62Vt35swAr99rX0jfBmdThWrhHQ/+oJ/mxcCcV hAWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=KDAfJYq5RKv17QGPQtW+0ytgCKvypNcMoXqEI7x1pO0=; b=HnORaeeuSFOYwo3gZwjBjzZ/Cfpzy7NHYgeeKYm1uHLH8kWIC0QOzpc2J81EtbWg0+ sHYAEYqqtbw2S2JmXK5uVzKExYW3tR+J0j2ifXN9TMiQhwA4iLQI9XbzRvPDJ5IG70cR la12mvh4Z6hye9uJftVFycO0Dt8JwdnKBRGCCOm6a+Bk+oroT404NBSZYI8sXgSQQzzH hU86pJ54NUV1DIFDh0WV3Urd4LStxhl43FK/s3FPt8KDdIPNXioFneH9OpTrxuBbJwK+ 1lkRlfr49DpLv6FBzDo+c9V/WCEcVEav9A7zRm1f5CjjL350+w3cJjCEXWh/nG0W5jjB XZ9A== X-Gm-Message-State: AHYfb5jNQRL9LlcCACnX4nSRYKkQwhoG5XG5+QDJ5O7WzEFaLlAyDwbM VVgOJrfQbiAg5L4KLRVvksCqx7RVjg== X-Received: by 10.55.101.15 with SMTP id z15mr6040483qkb.259.1502965950514; Thu, 17 Aug 2017 03:32:30 -0700 (PDT) Original-Received: by 10.12.179.20 with HTTP; Thu, 17 Aug 2017 03:32:10 -0700 (PDT) In-Reply-To: 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:135862 Archived-At: --94eb2c058ea4970c360556f087d0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Turns out it's not so simple, because electric-pair-text-pairs is autoloade= d and thus relying on electric-quote-chars is a problem. Loading loaddefs.el (source)... Symbol's value as variable is void: electric-quote-chars Makefile:535: recipe for target 'emacs' failed I could: 1. Add an autoload to electric-quote-chars. (Unfortunately I seem to fail at that, just adding the cookie isn't enough, it has to go into ldefs-boot.el somehow). 2. Replace those (nth...) expressions with the actual quote characters. It's no more disconnected from a possible customized value in electric-quote-chars than it is now. 3. Rework elec-pair.el so that lisp expressions are accepted in electric-pair-text-pairs and evaluated just-in-time. Anyway, It's been more than 1 year since my last contribution to Emacs, and I shouldn't make this decision alone. Eli, could you please weigh in or point me to someone who can? Emacs-devel? Thanks, Jo=C3=A3o On Sun, Aug 13, 2017 at 11:59 AM, Reuben Thomas wrote: > Thanks very much, I fear that was just ineptitude on my part. > > -- > https://rrt.sc3d.org > > On 13 Aug 2017 11:57 am, "Jo=C3=A3o T=C3=A1vora" w= rote: > >> Hi Reuben, >> >> Casually glancing at the source for lisp/elec-pair.el I have found an >> error. >> >> You cannot use lists like (nth 0 electric-quote-chars) inside a quoted >> list as >> you did in your patch of Nov. 8 2016. The list will not be evaluated. >> Perhaps >> you were distracted by the grim events taking place that day :-) >> >> Anyway, I think you meant backquote-and-comma so I'll install this fix >> soon, >> unless anyone objects. >> >> Jo=C3=A3o >> >> >> diff --git a/lisp/elec-pair.el b/lisp/elec-pair.el >> index 87e82e2..4ede4f1 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 >> @@ -44,9 +44,9 @@ electric-pair-pairs >> >> ;;;###autoload >> (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 >> >> --94eb2c058ea4970c360556f087d0 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Turns out it's not so simple, because electric-pair-te= xt-pairs is autoloaded
and thus relying on electric-quote-chars is a pr= oblem.

Loading loaddefs.el (source)...
<= div>Symbol's value as variable is void: electric-quote-chars
= Makefile:535: recipe for target 'emacs' failed

=
I could:

1. Add an autoload to electric= -quote-chars. (Unfortunately I seem to fail at that,
just adding = the cookie isn't enough, it has to go into ldefs-boot.el somehow).

2. Replace those (nth...) expressions with the actual = quote characters. It's no=C2=A0
more disconnected from a poss= ible customized value in electric-quote-chars=C2=A0
than it is no= w.

3. Rework elec-pair.el so that lisp expressions= are accepted in electric-pair-text-pairs
and evaluated just-in-t= ime.

Anyway, It's been more than 1 year since = my last contribution to Emacs, and
I shouldn't make this deci= sion alone. Eli, could you please weigh in or point me
to someone= who can? Emacs-devel?

Thanks,
Jo=C3=A3o= =C2=A0
=C2=A0

On Sun, Aug 13, 2017 at 11:59 AM, Reuben Thomas <rrt@sc3d.org= > wrote:
Thanks very much, I fear that was just ineptitude on my = part.


On 13 Aug 2= 017 11:57 am, "Jo=C3=A3o T=C3=A1vora" <joaotavora@gmail.com> wrote:
Hi Reuben,

Casually glancing at the so= urce for lisp/elec-pair.el I have found an error.=C2=A0

= You cannot use lists like (nth 0 electric-quote-chars) inside a quoted list= as=C2=A0
you did in your patch of Nov. 8 2016. The list will not= be evaluated. Perhaps=C2=A0
you were distracted by the grim even= ts taking place that day :-)=C2=A0

Anyway, I think= you meant backquote-and-comma so I'll install this fix soon,
unless anyone objects.

Jo=C3=A3o


diff --git a/lisp/elec-pair.el b/lisp/elec-pai= r.el
index 87e82e2..4ede4f1 100644
--- a/lisp/elec-pair= .el
+++ b/lisp/elec-pair.el
@@ -28,9 +28,9 @@
=C2=A0;;; Electric pairing.
=C2=A0
=C2=A0(defcustom el= ectric-pair-pairs
- =C2=A0'((?\" . ?\")
-= =C2=A0 =C2=A0((nth 0 electric-quote-chars) . (nth 1 electric-quote-chars))=
- =C2=A0 =C2=A0((nth 2 electric-quote-chars) . (nth 3 electric-q= uote-chars)))
+ =C2=A0`((?\" . ?\")
+ =C2=A0 = =C2=A0(,(nth 0 electric-quote-chars) . ,(nth 1 electric-quote-chars))
=
+ =C2=A0 =C2=A0(,(nth 2 electric-quote-chars) . ,(nth 3 electric-quote= -chars)))
=C2=A0 =C2=A0"Alist of pairs that should be used r= egardless of major mode.
=C2=A0
=C2=A0Pairs of delimite= rs in this list are a fallback in case they have
@@ -44,9 +44,9 @= @ electric-pair-pairs
=C2=A0
=C2=A0;;;###autoload
=
=C2=A0(defcustom electric-pair-text-pairs
- =C2=A0'((?\&= quot; . ?\" )
- =C2=A0 =C2=A0((nth 0 electric-quote-chars) .= (nth 1 electric-quote-chars))
- =C2=A0 =C2=A0((nth 2 electric-qu= ote-chars) . (nth 3 electric-quote-chars)))
+ =C2=A0`((?\" .= ?\" )
+ =C2=A0 =C2=A0(,(nth 0 electric-quote-chars) . ,(nth= 1 electric-quote-chars))
+ =C2=A0 =C2=A0(,(nth 2 electric-quote-= chars) . ,(nth 3 electric-quote-chars)))
=C2=A0 =C2=A0"Alist= of pairs that should always be used in comments and strings.
=C2= =A0
=C2=A0Pairs of delimiters in this list are a fallback in case= they have


--94eb2c058ea4970c360556f087d0--