From: Juri Linkov Date: Thu, 13 Jun 2013 22:08:45 +0000 (+0300) Subject: * lisp/isearch.el (isearch-query-replace): Add " symbol" and other X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~2016^2~119 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=bc5c8c5a6a1956122284468879862b1850dc3b5d;p=emacs.git * lisp/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. * lisp/replace.el (perform-replace): Display "symbol " and other search modes from `isearch-message-prefix' in the *Help* buffer. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 5327ce12e7b..98e0382853d 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,13 @@ +2013-06-13 Juri Linkov + + * 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 * isearch.el (word-search-regexp): Match whitespace if the search diff --git a/lisp/isearch.el b/lisp/isearch.el index 37070ba6f51..ec4f32aecca 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el @@ -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)))))) diff --git a/lisp/replace.el b/lisp/replace.el index 24cfccf60fd..be0ecda20fa 100644 --- a/lisp/replace.el +++ b/lisp/replace.el @@ -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"