1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-27 07:37:33 +00:00

* 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.
This commit is contained in:
Juri Linkov 2013-06-14 01:08:45 +03:00
parent a22289f7ab
commit bc5c8c5a6a
3 changed files with 35 additions and 11 deletions

View 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

View 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))))))

View 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"