* lisp/isearch.el (isearch-query-replace): Add " symbol" and other
authorJuri Linkov <juri@jurta.org>
Thu, 13 Jun 2013 22:08:45 +0000 (01:08 +0300)
committerJuri Linkov <juri@jurta.org>
Thu, 13 Jun 2013 22:08:45 +0000 (01:08 +0300)
possible search modes from `isearch-message-prefix' to the prompt.
(isearch-occur): Use `with-isearch-suspended' to not exit Isearch
when reading a regexp to collect.

* lisp/replace.el (perform-replace): Display "symbol " and other search
modes from `isearch-message-prefix' in the *Help* buffer.

lisp/ChangeLog
lisp/isearch.el
lisp/replace.el

index 5327ce1..98e0382 100644 (file)
@@ -1,3 +1,13 @@
+2013-06-13  Juri Linkov  <juri@jurta.org>
+
+       * replace.el (perform-replace): Display "symbol " and other search
+       modes from `isearch-message-prefix' in the *Help* buffer.
+
+       * isearch.el (isearch-query-replace): Add " symbol" and other
+       possible search modes from `isearch-message-prefix' to the prompt.
+       (isearch-occur): Use `with-isearch-suspended' to not exit Isearch
+       when reading a regexp to collect.
+
 2013-06-13  Juri Linkov  <juri@jurta.org>
 
        * isearch.el (word-search-regexp): Match whitespace if the search
index 37070ba..ec4f32a 100644 (file)
@@ -1678,9 +1678,10 @@ the beginning or the end of the string need not match a symbol boundary."
   "Start `query-replace' with string to replace from last search string.
 The arg DELIMITED (prefix arg if interactive), if non-nil, means replace
 only matches surrounded by word boundaries.  Note that using the prefix arg
-is possible only when `isearch-allow-scroll' is non-nil, and it doesn't
-always provide the correct matches for `query-replace', so the preferred
-way to run word replacements from Isearch is `M-s w ... M-%'."
+is possible only when `isearch-allow-scroll' is non-nil or
+`isearch-allow-prefix' is non-nil, and it doesn't always provide the
+correct matches for `query-replace', so the preferred way to run word
+replacements from Isearch is `M-s w ... M-%'."
   (interactive
    (list current-prefix-arg))
   (barf-if-buffer-read-only)
@@ -1714,7 +1715,15 @@ way to run word replacements from Isearch is `M-s w ... M-%'."
      (query-replace-read-to
       isearch-string
       (concat "Query replace"
-             (if (or delimited isearch-word) " word" "")
+             (if (or delimited isearch-word)
+                 (let* ((symbol (or delimited isearch-word))
+                        (string (and symbol (symbolp symbol)
+                                     (get symbol 'isearch-message-prefix))))
+                   (if (stringp string)
+                       ;; Move space from the end to the beginning.
+                       (replace-regexp-in-string "\\(.*\\) \\'" " \\1" string)
+                     " word"))
+               "")
              (if isearch-regexp " regexp" "")
              (if (and transient-mark-mode mark-active) " in region" ""))
       isearch-regexp)
@@ -1756,12 +1765,14 @@ characters in that string."
                   ;; No subexpression so collect the entire match.
                   "\\&"
                 ;; Get the regexp for collection pattern.
-                (isearch-done nil t)
-                (isearch-clean-overlays)
-                (let ((default (car occur-collect-regexp-history)))
-                  (read-regexp
-                   (format "Regexp to collect (default %s): " default)
-                   default 'occur-collect-regexp-history)))
+                (let ((default (car occur-collect-regexp-history))
+                      regexp-collect)
+                  (with-isearch-suspended
+                   (setq regexp-collect
+                         (read-regexp
+                          (format "Regexp to collect (default %s): " default)
+                          default 'occur-collect-regexp-history)))
+                  regexp-collect))
             ;; Otherwise normal occur takes numerical prefix argument.
             (when current-prefix-arg
               (prefix-numeric-value current-prefix-arg))))))
index 24cfccf..be0ecda 100644 (file)
@@ -2156,7 +2156,10 @@ make, or the user didn't cancel the call."
                         (with-output-to-temp-buffer "*Help*"
                           (princ
                            (concat "Query replacing "
-                                   (if delimited-flag "word " "")
+                                   (if delimited-flag
+                                       (or (and (symbolp delimited-flag)
+                                                (get delimited-flag 'isearch-message-prefix))
+                                           "word ") "")
                                    (if regexp-flag "regexp " "")
                                    from-string " with "
                                    next-replacement ".\n\n"