summaryrefslogtreecommitdiff
path: root/lisp/replace.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>2004-07-02 23:52:14 +0000
committerRichard M. Stallman <rms@gnu.org>2004-07-02 23:52:14 +0000
commit9e5d1b634e23145366cc7dffc8325d28d5a04941 (patch)
treedef661c59546152dc9bf6f0758ddf21ef75f7a0b /lisp/replace.el
parentb830b63b85d766d77daa5e4f835141cbf3d81980 (diff)
downloademacs-9e5d1b634e23145366cc7dffc8325d28d5a04941.tar.gz
(query-replace-read-args): Swallow space after symbols, not after
closeparens. But avoid error if string ends there.
Diffstat (limited to 'lisp/replace.el')
-rw-r--r--lisp/replace.el20
1 files changed, 12 insertions, 8 deletions
diff --git a/lisp/replace.el b/lisp/replace.el
index cac4470c9cd..8e8b43d66c6 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -118,14 +118,18 @@ strings or patterns."
((eq char ?\,)
(setq pos (read-from-string to))
(push `(replace-quote ,(car pos)) list)
- (setq to (substring
- to (+ (cdr pos)
- ;; Swallow a space after a symbol
- ;; if there is a space.
- (if (string-match
- "^[^])\"] "
- (substring to (1- (cdr pos))))
- 1 0))))))
+ (let ((end
+ ;; Swallow a space after a symbol
+ ;; if there is a space.
+ (if (and (or (symbolp (car pos))
+ ;; Swallow a space after 'foo
+ ;; but not after (quote foo).
+ (and (eq (car-safe (car pos)) 'quote)
+ (= ?\( (aref to 0))))
+ (string-match " " to (cdr pos)))
+ (1+ (cdr pos))
+ (cdr pos))))
+ (setq to (substring to end)))))
(string-match "\\(\\`\\|[^\\]\\)\\(\\\\\\\\\\)*\\\\[,#]" to)))
(setq to (nreverse (delete "" (cons to list)))))
(replace-match-string-symbols to)