aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuri Linkov2004-06-28 23:03:06 +0000
committerJuri Linkov2004-06-28 23:03:06 +0000
commitda6eb51ce427cad783259c87fef958e32ab75688 (patch)
tree24f84d4e9d7cf32ebf39bfb2cc02cdb4ad1aab59
parentbf77a4208bd8889d28f37173286024424da9d103 (diff)
downloademacs-da6eb51ce427cad783259c87fef958e32ab75688.tar.gz
emacs-da6eb51ce427cad783259c87fef958e32ab75688.zip
(query-replace-read-args): Swallow a space after
everything except )]" which in most cases means after a symbol.
-rw-r--r--lisp/replace.el25
1 files changed, 10 insertions, 15 deletions
diff --git a/lisp/replace.el b/lisp/replace.el
index c68a420db7a..c2305cdecc6 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -109,23 +109,18 @@ strings or patterns."
109 ((eq char ?\,) 109 ((eq char ?\,)
110 (setq pos (read-from-string to)) 110 (setq pos (read-from-string to))
111 (push `(replace-quote ,(car pos)) list) 111 (push `(replace-quote ,(car pos)) list)
112 (let ((end 112 (setq to (substring
113 ;; Swallow a space after a symbol 113 to (+ (cdr pos)
114 ;; if there is a space. 114 ;; Swallow a space after a symbol
115 (if (and (or (symbolp (car pos)) 115 ;; if there is a space.
116 ;; Swallow a space after 'foo 116 (if (string-match
117 ;; but not after (quote foo). 117 "^[^])\"] "
118 (and (eq (car-safe (car pos)) 'quote) 118 (substring to (1- (cdr pos))))
119 (= ?\( (aref to-string 0)))) 119 1 0))))))
120 (equal " " (substring to-string (cdr pos)
121 (1+ (cdr pos)))))
122 (1+ (cdr pos))
123 (cdr pos))))
124 (setq to (substring to end)))))
125 (string-match "\\(\\`\\|[^\\]\\)\\(\\\\\\\\\\)*\\\\[,#]" to))) 120 (string-match "\\(\\`\\|[^\\]\\)\\(\\\\\\\\\\)*\\\\[,#]" to)))
126 (setq to (nreverse (delete "" (cons to list))))) 121 (setq to (nreverse (delete "" (cons to list)))))
127 (replace-match-string-symbols to) 122 (replace-match-string-symbols to)
128 (setq to (cons 'replace-eval-replacement 123 (setq to (cons 'replace-eval-replacement
129 (if (> (length to) 1) 124 (if (> (length to) 1)
130 (cons 'concat to) 125 (cons 'concat to)
131 (car to))))) 126 (car to)))))
@@ -1397,7 +1392,7 @@ make, or the user didn't cancel the call."
1397 ((eq def 'act-and-exit) 1392 ((eq def 'act-and-exit)
1398 (or replaced 1393 (or replaced
1399 (setq noedit 1394 (setq noedit
1400 (replace-match-maybe-edit 1395 (replace-match-maybe-edit
1401 next-replacement nocasify literal 1396 next-replacement nocasify literal
1402 noedit real-match-data) 1397 noedit real-match-data)
1403 replace-count (1+ replace-count))) 1398 replace-count (1+ replace-count)))