all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: joaotavora@gmail.com (João Távora)
To: Eli Zaretskii <eliz@gnu.org>
Cc: 24901@debbugs.gnu.org, npostavs@users.sourceforge.net, rrt@sc3d.org
Subject: bug#24901: Caught mistake in elec-pair.el patch
Date: Thu, 17 Aug 2017 16:36:19 +0100	[thread overview]
Message-ID: <87valm1a18.fsf@lolita> (raw)
In-Reply-To: <8360dmff2n.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 17 Aug 2017 17:23:44 +0300")

[-- Attachment #1: Type: text/plain, Size: 1187 bytes --]

Eli Zaretskii <eliz@gnu.org> writes:

>> From: João Távora <joaotavora@gmail.com>
>> Date: Thu, 17 Aug 2017 14:32:08 +0100
>> Cc: Reuben Thomas <rrt@sc3d.org>, 24901@debbugs.gnu.org, Eli Zaretskii <eliz@gnu.org>
>> 
>> On Thu, Aug 17, 2017 at 1:35 PM, <npostavs@users.sourceforge.net> wrote:
>> 
>> > Or remove the autoload from electric-pair-text-pairs?
>> 
>> Seems to be there for a reason, unfortunately. It's forward 
>> 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ão


[-- Attachment #2: 0001-lisp-elec-pair.el-electric-pair-text-pairs-Don-t-aut.patch --]
[-- Type: text/x-diff, Size: 1889 bytes --]

From 3e5a166cb7e5b575252c5c69c2678d2074d58c12 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
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)))
 
-;;;###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 '((?\` . ?\') (?‘ . ?’)) electric-pair-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 '((?\` . ?\') (?‘ . ?’)) 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)
-- 
2.11.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-Fix-default-value-of-electric-pair-pairs-and-electri.patch --]
[-- Type: text/x-diff, Size: 2023 bytes --]

From a96f9ed05edfe619f7bc4edf5485c937e3df4d1b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jo=C3=A3o=20T=C3=A1vora?= <joaotavora@gmail.com>
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


  reply	other threads:[~2017-08-17 15:36 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CALDnm513tFORnxwH7a_hn7Birk-s7z44ftxO2uitMM7Rb2dQKA@mail.gmail.com>
2017-08-13 11:03 ` bug#24901: Fwd: Caught mistake in elec-pair.el patch João Távora
     [not found] ` <CAOnWdojZmNrAN1ioAPk_YTik0LU-qz26SrA3pmocJznuB-Bd4A@mail.gmail.com>
2017-08-17 10:32   ` bug#24901: " João Távora
2017-08-17 12:35     ` npostavs
2017-08-17 13:32       ` João Távora
2017-08-17 14:05         ` Noam Postavsky
2017-08-17 14:23         ` Eli Zaretskii
2017-08-17 15:36           ` João Távora [this message]
2017-08-17 15:49             ` Noam Postavsky
2017-08-17 16:57               ` João Távora
2017-08-18  1:51             ` npostavs
2017-08-18 19:21               ` Reuben Thomas
2017-08-18 22:46               ` João Távora
2017-08-19  0:41                 ` Noam Postavsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87valm1a18.fsf@lolita \
    --to=joaotavora@gmail.com \
    --cc=24901@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=npostavs@users.sourceforge.net \
    --cc=rrt@sc3d.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.