mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-04-27 16:51:06 -07:00
Factor isearch word description into new function
* lisp/isearch.el (isearch--describe-word-mode): New function. (isearch-message-prefix, isearch-query-replace): Use it.
This commit is contained in:
parent
65571b37ed
commit
4fff58dd1e
1 changed files with 20 additions and 17 deletions
|
|
@ -1766,16 +1766,8 @@ replacements from Isearch is `M-s w ... M-%'."
|
|||
(query-replace-read-to
|
||||
isearch-string
|
||||
(concat "Query replace"
|
||||
(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" "")
|
||||
(isearch--describe-word-mode (or delimited isearch-word) t)
|
||||
(if isearch-regexp " regexp" "")
|
||||
(if backward " backward" "")
|
||||
(if (and transient-mark-mode mark-active) " in region" ""))
|
||||
isearch-regexp)
|
||||
|
|
@ -2521,6 +2513,21 @@ If there is no completion possible, say so and continue searching."
|
|||
(isearch-message-suffix c-q-hack)))
|
||||
(if c-q-hack m (let ((message-log-max nil)) (message "%s" m)))))
|
||||
|
||||
(defun isearch--describe-word-mode (word-mode &optional space-before)
|
||||
"Make a string for describing WORD-MODE.
|
||||
If SPACE-BEFORE is non-nil, put a space before, instead of after,
|
||||
the word mode."
|
||||
(let ((description
|
||||
(cond ((and (symbolp word-mode)
|
||||
(get word-mode 'isearch-message-prefix))
|
||||
(get word-mode 'isearch-message-prefix))
|
||||
(word-mode "word ")
|
||||
(t ""))))
|
||||
(if space-before
|
||||
;; Move space from the end to the beginning.
|
||||
(replace-regexp-in-string "\\(.*\\) \\'" " \\1" description)
|
||||
description)))
|
||||
|
||||
(defun isearch-message-prefix (&optional ellipsis nonincremental)
|
||||
;; If about to search, and previous search regexp was invalid,
|
||||
;; check that it still is. If it is valid now,
|
||||
|
|
@ -2547,13 +2554,9 @@ If there is no completion possible, say so and continue searching."
|
|||
(let ((np (cdr (assq 'isearch-message-prefix props))))
|
||||
(if np (setq prefix (concat np prefix)))))
|
||||
isearch-filter-predicate)
|
||||
prefix)
|
||||
(if isearch-word
|
||||
(or (and (symbolp isearch-word)
|
||||
(get isearch-word 'isearch-message-prefix))
|
||||
"word ")
|
||||
"")
|
||||
(if isearch-regexp "regexp " "")
|
||||
prefix)
|
||||
(isearch--describe-word-mode isearch-word)
|
||||
(if isearch-regexp "regexp " "")
|
||||
(cond
|
||||
(multi-isearch-file-list "multi-file ")
|
||||
(multi-isearch-buffer-list "multi-buffer ")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue