GNU bug report logs - #24901
Patch to add support for curly quotes to electric-pair-mode

Previous Next

Package: emacs;

Reported by: Reuben Thomas <rrt <at> sc3d.org>

Date: Tue, 8 Nov 2016 12:01:02 UTC

Severity: wishlist

Tags: patch

Done: Reuben Thomas <rrt <at> sc3d.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: João Távora <joaotavora <at> gmail.com>
To: Reuben Thomas <rrt <at> sc3d.org>
Cc: 24901 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>
Subject: bug#24901: Caught mistake in elec-pair.el patch
Date: Thu, 17 Aug 2017 11:32:10 +0100
[Message part 1 (text/plain, inline)]
Turns out it's not so simple, because electric-pair-text-pairs is autoloaded
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ão


On Sun, Aug 13, 2017 at 11:59 AM, Reuben Thomas <rrt <at> sc3d.org> 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ão Távora" <joaotavora <at> gmail.com> wrote:
>
>> 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ão
>>
>>
>> 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
>>
>>
[Message part 2 (text/html, inline)]

This bug report was last modified 7 years and 279 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.