emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master 9c65298: [el-search] Raise user-error when replacement con


From: Michael Heerdegen
Subject: [elpa] master 9c65298: [el-search] Raise user-error when replacement contains gensyms
Date: Mon, 21 May 2018 10:52:08 -0400 (EDT)

branch: master
commit 9c652980b3c271f9320edecd329b17d5e04cf385
Author: Michael Heerdegen <address@hidden>
Commit: Michael Heerdegen <address@hidden>

    [el-search] Raise user-error when replacement contains gensyms
    
    * el-search/el-search.el (el-search--format-replacement): Raise a
    `user-error' when replacement contains uninterned symbols.
    
    Also improve the comment about this issue in the file header.
---
 packages/el-search/el-search.el | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/packages/el-search/el-search.el b/packages/el-search/el-search.el
index 0f2c77b..8f032a5 100644
--- a/packages/el-search/el-search.el
+++ b/packages/el-search/el-search.el
@@ -369,11 +369,11 @@
 ;;
 ;;   the comment will be lost.
 ;;
-;; - Something like '(1 #1#) is unmatchable (because it is
-;;   un`read'able without context).  For a similar reason it is
-;;   currently not possible to allow a replacement to contain
-;;   uninterned symbols or repeated/circular parts.
+;; - Something like (1 #1#) is unmatchable (because it is un`read'able
+;;   without context).
 ;;
+;; - In el-search-query-replace, replacements are not allowed to
+;;   contain uninterned symbols.
 ;;
 ;;
 ;; BUGS
@@ -3245,6 +3245,12 @@ reindent."
             (goto-char 1)
             (forward-sexp (if splice (length replacement) 1))
             (let ((result (buffer-substring 1 (point))))
+              (when (cl-some
+                     (lambda (thing) (and (symbolp thing) thing (not 
(intern-soft thing))))
+                     (el-search--flatten-tree replacement))
+                ;; el-search can't handle #N read syntax; we print the 
replacement
+                ;; with print-circle -> nil
+                (user-error "The replacement is not allowed to contain 
uninterned symbols"))
               (if (condition-case nil
                       (equal replacement (el-search-read (if splice (format 
"(%s)" result) result)))
                     ((debug error) nil))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]