Commit d85519bb authored by Juri Linkov's avatar Juri Linkov

(isearch-toggle-regexp): Set `isearch-success' and `isearch-adjusted' to `t'.

(isearch-toggle-case-fold): Set `isearch-success' to `t'.
(isearch-message-prefix): Add "pending" for isearch-adjusted.
(isearch-other-meta-char): Restore isearch-point unconditionally.
(isearch-query-replace): Add new arg `regexp-flag' and use it.
Set point to start of match if region is not active in transient
mark mode (to include the current match to region boundaries).
Push the search string to `query-replace-from-history-variable'.
Add prompt "Query replace regexp" for isearch-regexp.
Add region beginning/end as last arguments of `perform-replace.'
(isearch-query-replace-regexp): Replace code by the call to
`isearch-query-replace' with arg `t'.
parent b4fab893
...@@ -1088,6 +1088,7 @@ Use `isearch-exit' to quit without signaling." ...@@ -1088,6 +1088,7 @@ Use `isearch-exit' to quit without signaling."
(interactive) (interactive)
(setq isearch-regexp (not isearch-regexp)) (setq isearch-regexp (not isearch-regexp))
(if isearch-regexp (setq isearch-word nil)) (if isearch-regexp (setq isearch-word nil))
(setq isearch-success t isearch-adjusted t)
(isearch-update)) (isearch-update))
(defun isearch-toggle-case-fold () (defun isearch-toggle-case-fold ()
...@@ -1100,34 +1101,39 @@ Use `isearch-exit' to quit without signaling." ...@@ -1100,34 +1101,39 @@ Use `isearch-exit' to quit without signaling."
(isearch-message-prefix nil nil isearch-nonincremental) (isearch-message-prefix nil nil isearch-nonincremental)
isearch-message isearch-message
(if isearch-case-fold-search "in" ""))) (if isearch-case-fold-search "in" "")))
(setq isearch-adjusted t) (setq isearch-success t isearch-adjusted t)
(sit-for 1) (sit-for 1)
(isearch-update)) (isearch-update))
(defun isearch-query-replace () (defun isearch-query-replace (&optional regexp-flag)
"Start query-replace with string to replace from last search string." "Start query-replace with string to replace from last search string."
(interactive) (interactive)
(barf-if-buffer-read-only) (barf-if-buffer-read-only)
(if regexp-flag (setq isearch-regexp t))
(let ((case-fold-search isearch-case-fold-search)) (let ((case-fold-search isearch-case-fold-search))
(isearch-done) (isearch-done)
(isearch-clean-overlays) (isearch-clean-overlays)
(and isearch-forward isearch-other-end (goto-char isearch-other-end)) (if (and (< isearch-other-end (point))
(not (and transient-mark-mode mark-active
(< isearch-opoint (point)))))
(goto-char isearch-other-end))
(set query-replace-from-history-variable
(cons isearch-string
(symbol-value query-replace-from-history-variable)))
(perform-replace (perform-replace
isearch-string isearch-string
(query-replace-read-to isearch-string "Query replace" isearch-regexp) (query-replace-read-to
t isearch-regexp isearch-word))) isearch-string
(if isearch-regexp "Query replace regexp" "Query replace")
isearch-regexp)
t isearch-regexp isearch-word nil nil
(if (and transient-mark-mode mark-active) (region-beginning))
(if (and transient-mark-mode mark-active) (region-end)))))
(defun isearch-query-replace-regexp () (defun isearch-query-replace-regexp ()
"Start query-replace-regexp with string to replace from last search string." "Start query-replace-regexp with string to replace from last search string."
(interactive) (interactive)
(let ((query-replace-interactive t) (isearch-query-replace t))
(case-fold-search isearch-case-fold-search))
;; Put search string into the right ring
(setq isearch-regexp t)
(isearch-done)
(isearch-clean-overlays)
(and isearch-forward isearch-other-end (goto-char isearch-other-end))
(call-interactively 'query-replace-regexp)))
(defun isearch-delete-char () (defun isearch-delete-char ()
...@@ -1620,8 +1626,7 @@ Isearch mode." ...@@ -1620,8 +1626,7 @@ Isearch mode."
(let ((ab-bel (isearch-string-out-of-window isearch-point))) (let ((ab-bel (isearch-string-out-of-window isearch-point)))
(if ab-bel (if ab-bel
(isearch-back-into-window (eq ab-bel 'above) isearch-point) (isearch-back-into-window (eq ab-bel 'above) isearch-point)
(or (eq (point) isearch-point) (goto-char isearch-point)))
(goto-char isearch-point))))
(isearch-update)) (isearch-update))
(search-exit-option (search-exit-option
(let (window) (let (window)
...@@ -1895,6 +1900,7 @@ If there is no completion possible, say so and continue searching." ...@@ -1895,6 +1900,7 @@ If there is no completion possible, say so and continue searching."
;; If currently failing, display no ellipsis. ;; If currently failing, display no ellipsis.
(or isearch-success (setq ellipsis nil)) (or isearch-success (setq ellipsis nil))
(let ((m (concat (if isearch-success "" "failing ") (let ((m (concat (if isearch-success "" "failing ")
(if isearch-adjusted "pending " "")
(if (and isearch-wrapped (if (and isearch-wrapped
(not isearch-wrap-function) (not isearch-wrap-function)
(if isearch-forward (if isearch-forward
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment