]> git.eshelyaron.com Git - emacs.git/commitdiff
(query-replace-read-args): Swallow space after symbols, not after
authorRichard M. Stallman <rms@gnu.org>
Fri, 2 Jul 2004 23:52:14 +0000 (23:52 +0000)
committerRichard M. Stallman <rms@gnu.org>
Fri, 2 Jul 2004 23:52:14 +0000 (23:52 +0000)
closeparens.  But avoid error if string ends there.

lisp/replace.el

index cac4470c9cd6d1768579de655b55cd7b555f5a6e..8e8b43d66c64dc6a8fe4a723080bc08b88a17576 100644 (file)
@@ -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)