GNU bug report logs -
#19505
25.0.50; Defining a chomp function breaks electric pairing
Previous Next
Reported by: Tom Willemse <tom <at> ryuslash.org>
Date: Sun, 4 Jan 2015 14:54:02 UTC
Severity: normal
Found in version 25.0.50
Fixed in version 25.1
Done: Glenn Morris <rgm <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:
>> The attached patch fixes the situation where a function `chomp' exists
>> and `electric-pair-skip-whitespace' has the value `chomp'. Since that
>> specific symbol is mentioned as a special case for this variable, it
>> seems that it shouldn't try to call a function named as such.
>
> Maybe a better option is to use the value `:chomp' instead of `chomp',
> since defining a function `:chomp' should be considered an error anyway,
I've attached a patch with the change as you suggested. It seems to me
this change might need an entry in the NEWS file, since it changes the
value of `electric-pair-skip-whitespace' from a symbol to a keyword,
people might be confused that their configuration suddenly stopped
working. I just had no idea how to describe this in a NEWS-friendly way.
Perhaps a test should be written for this as well? If someone could
suggest where to put such a test I would happily (try to) write it.
[0001-Use-a-keyword-not-symbol-to-delete-whitespace.patch (text/x-diff, inline)]
From c9dfaff53b11f6db401d8ed7a7d25e1efb45c461 Mon Sep 17 00:00:00 2001
From: Tom Willemse <tom <at> ryuslash.org>
Date: Tue, 6 Jan 2015 20:37:29 +0100
Subject: [PATCH] Use a keyword, not symbol, to delete whitespace
* elec-pair.el (electric-pair-skip-whitespace): Use `:chomp' instead
of `chomp'.
(electric-pair-post-self-insert-function): Check for a keyword
`:chomp' instead of the symbol `chomp' to prevent naming conflicts.
---
lisp/ChangeLog | 8 ++++++++
lisp/elec-pair.el | 6 +++---
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 76ba2cd..cd7cd2a 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,11 @@
+2015-01-06 Tom Willemse <tom <at> ryuslash.org>
+
+ * elec-pair.el (electric-pair-skip-whitespace): Use `:chomp'
+ instead of `chomp'.
+ (electric-pair-post-self-insert-function): Check for a keyword
+ `:chomp' instead of the symbol `chomp' to prevent naming
+ conflicts.
+
2015-01-05 Dmitry Gutov <dgutov <at> yandex.ru>
* progmodes/xref.el (xref--insert-xrefs): Add `help-echo' property
diff --git a/lisp/elec-pair.el b/lisp/elec-pair.el
index 2cede62..270f4a3 100644
--- a/lisp/elec-pair.el
+++ b/lisp/elec-pair.el
@@ -129,7 +129,7 @@ (defcustom electric-pair-skip-whitespace
The specific kind of whitespace skipped is given by the variable
`electric-pair-skip-whitespace-chars'.
-The symbol `chomp' specifies that the skipped-over whitespace
+The keyword `:chomp' specifies that the skipped-over whitespace
should be deleted.
Can also be a function of no arguments, in which case that function's
@@ -138,7 +138,7 @@ (defcustom electric-pair-skip-whitespace
:group 'electricity
:type '(choice
(const :tag "Yes, jump over whitespace" t)
- (const :tag "Yes, and delete whitespace" chomp)
+ (const :tag "Yes, and delete whitespace" :chomp)
(const :tag "No, no whitespace skipping" nil)
function))
@@ -487,7 +487,7 @@ (defun electric-pair-post-self-insert-function
;; live with it for now.
(when skip-whitespace-info
(electric-pair--skip-whitespace))
- (delete-region (1- pos) (if (eq skip-whitespace-info 'chomp)
+ (delete-region (1- pos) (if (eq skip-whitespace-info :chomp)
(point)
pos))
(forward-char))
--
2.2.1
This bug report was last modified 10 years and 37 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.