aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/replace.el
diff options
context:
space:
mode:
authorRichard M. Stallman2004-07-02 23:52:14 +0000
committerRichard M. Stallman2004-07-02 23:52:14 +0000
commit9e5d1b634e23145366cc7dffc8325d28d5a04941 (patch)
treedef661c59546152dc9bf6f0758ddf21ef75f7a0b /lisp/replace.el
parentb830b63b85d766d77daa5e4f835141cbf3d81980 (diff)
downloademacs-9e5d1b634e23145366cc7dffc8325d28d5a04941.tar.gz
emacs-9e5d1b634e23145366cc7dffc8325d28d5a04941.zip
(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."
118 ((eq char ?\,) 118 ((eq char ?\,)
119 (setq pos (read-from-string to)) 119 (setq pos (read-from-string to))
120 (push `(replace-quote ,(car pos)) list) 120 (push `(replace-quote ,(car pos)) list)
121 (setq to (substring 121 (let ((end
122 to (+ (cdr pos) 122 ;; Swallow a space after a symbol
123 ;; Swallow a space after a symbol 123 ;; if there is a space.
124 ;; if there is a space. 124 (if (and (or (symbolp (car pos))
125 (if (string-match 125 ;; Swallow a space after 'foo
126 "^[^])\"] " 126 ;; but not after (quote foo).
127 (substring to (1- (cdr pos)))) 127 (and (eq (car-safe (car pos)) 'quote)
128 1 0)))))) 128 (= ?\( (aref to 0))))
129 (string-match " " to (cdr pos)))
130 (1+ (cdr pos))
131 (cdr pos))))
132 (setq to (substring to end)))))
129 (string-match "\\(\\`\\|[^\\]\\)\\(\\\\\\\\\\)*\\\\[,#]" to))) 133 (string-match "\\(\\`\\|[^\\]\\)\\(\\\\\\\\\\)*\\\\[,#]" to)))
130 (setq to (nreverse (delete "" (cons to list))))) 134 (setq to (nreverse (delete "" (cons to list)))))
131 (replace-match-string-symbols to) 135 (replace-match-string-symbols to)