summaryrefslogtreecommitdiff
path: root/lisp/isearch.el
diff options
context:
space:
mode:
authorJuri Linkov <juri@jurta.org>2008-11-11 19:48:37 +0000
committerJuri Linkov <juri@jurta.org>2008-11-11 19:48:37 +0000
commit8d32ed64169cd4d63c1616af1e8883f7540be14a (patch)
tree501b8561b8fc06c63a499d2941c109e7d4a986e8 /lisp/isearch.el
parent8c740e4c10912a048e0d02aeb0b78e4579d39fb6 (diff)
downloademacs-8d32ed64169cd4d63c1616af1e8883f7540be14a.tar.gz
* isearch.el (isearch-query-replace, isearch-highlight-regexp):
Bind `isearch-recursive-edit' to nil to prevent calling `exit-recursive-edit' in `isearch-done' that terminates the execution of these commands when it is non-nil. Call `exit-recursive-edit' explicitly at the end. (isearch-occur): For word search construct the correct regexp with word boundaries to proceed with occur.
Diffstat (limited to 'lisp/isearch.el')
-rw-r--r--lisp/isearch.el30
1 files changed, 23 insertions, 7 deletions
diff --git a/lisp/isearch.el b/lisp/isearch.el
index ac911de3ffb..8ec21750e25 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -1347,8 +1347,13 @@ way to run word replacements from Isearch is `M-s w ... M-%'."
(let ((case-fold-search isearch-case-fold-search)
;; set `search-upper-case' to nil to not call
;; `isearch-no-upper-case-p' in `perform-replace'
- (search-upper-case nil))
- (isearch-done)
+ (search-upper-case nil)
+ ;; Set `isearch-recursive-edit' to nil to prevent calling
+ ;; `exit-recursive-edit' in `isearch-done' that terminates
+ ;; the execution of this command when it is non-nil.
+ ;; We call `exit-recursive-edit' explicitly at the end below.
+ (isearch-recursive-edit nil))
+ (isearch-done nil t)
(isearch-clean-overlays)
(if (and isearch-other-end
(< isearch-other-end (point))
@@ -1369,7 +1374,8 @@ way to run word replacements from Isearch is `M-s w ... M-%'."
isearch-regexp)
t isearch-regexp (or delimited isearch-word) nil nil
(if (and transient-mark-mode mark-active) (region-beginning))
- (if (and transient-mark-mode mark-active) (region-end)))))
+ (if (and transient-mark-mode mark-active) (region-end))))
+ (and isearch-recursive-edit (exit-recursive-edit)))
(defun isearch-query-replace-regexp (&optional delimited)
"Start `query-replace-regexp' with string to replace from last search string.
@@ -1384,7 +1390,10 @@ Interactively, REGEXP is the current search regexp or a quoted search
string. NLINES has the same meaning as in `occur'."
(interactive
(list
- (if isearch-regexp isearch-string (regexp-quote isearch-string))
+ (cond
+ (isearch-word (concat "\\b" (regexp-quote isearch-string) "\\b"))
+ (isearch-regexp isearch-string)
+ (t (regexp-quote isearch-string)))
(if current-prefix-arg (prefix-numeric-value current-prefix-arg))))
(let ((case-fold-search isearch-case-fold-search)
;; set `search-upper-case' to nil to not call
@@ -1401,8 +1410,14 @@ It exits Isearch mode and calls `hi-lock-face-buffer' with its regexp
argument from the last search regexp or a quoted search string,
and reads its face argument using `hi-lock-read-face-name'."
(interactive)
- (isearch-done)
- (isearch-clean-overlays)
+ (let (
+ ;; Set `isearch-recursive-edit' to nil to prevent calling
+ ;; `exit-recursive-edit' in `isearch-done' that terminates
+ ;; the execution of this command when it is non-nil.
+ ;; We call `exit-recursive-edit' explicitly at the end below.
+ (isearch-recursive-edit nil))
+ (isearch-done nil t)
+ (isearch-clean-overlays))
(require 'hi-lock nil t)
(let ((string (cond (isearch-regexp isearch-string)
((if (and (eq isearch-case-fold-search t)
@@ -1420,7 +1435,8 @@ and reads its face argument using `hi-lock-read-face-name'."
(regexp-quote s))))
isearch-string ""))
(t (regexp-quote isearch-string)))))
- (hi-lock-face-buffer string (hi-lock-read-face-name))))
+ (hi-lock-face-buffer string (hi-lock-read-face-name)))
+ (and isearch-recursive-edit (exit-recursive-edit)))
(defun isearch-delete-char ()