aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuri Linkov2008-11-11 19:48:37 +0000
committerJuri Linkov2008-11-11 19:48:37 +0000
commit8d32ed64169cd4d63c1616af1e8883f7540be14a (patch)
tree501b8561b8fc06c63a499d2941c109e7d4a986e8
parent8c740e4c10912a048e0d02aeb0b78e4579d39fb6 (diff)
downloademacs-8d32ed64169cd4d63c1616af1e8883f7540be14a.tar.gz
emacs-8d32ed64169cd4d63c1616af1e8883f7540be14a.zip
* 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.
-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-%'."
1347 (let ((case-fold-search isearch-case-fold-search) 1347 (let ((case-fold-search isearch-case-fold-search)
1348 ;; set `search-upper-case' to nil to not call 1348 ;; set `search-upper-case' to nil to not call
1349 ;; `isearch-no-upper-case-p' in `perform-replace' 1349 ;; `isearch-no-upper-case-p' in `perform-replace'
1350 (search-upper-case nil)) 1350 (search-upper-case nil)
1351 (isearch-done) 1351 ;; Set `isearch-recursive-edit' to nil to prevent calling
1352 ;; `exit-recursive-edit' in `isearch-done' that terminates
1353 ;; the execution of this command when it is non-nil.
1354 ;; We call `exit-recursive-edit' explicitly at the end below.
1355 (isearch-recursive-edit nil))
1356 (isearch-done nil t)
1352 (isearch-clean-overlays) 1357 (isearch-clean-overlays)
1353 (if (and isearch-other-end 1358 (if (and isearch-other-end
1354 (< isearch-other-end (point)) 1359 (< isearch-other-end (point))
@@ -1369,7 +1374,8 @@ way to run word replacements from Isearch is `M-s w ... M-%'."
1369 isearch-regexp) 1374 isearch-regexp)
1370 t isearch-regexp (or delimited isearch-word) nil nil 1375 t isearch-regexp (or delimited isearch-word) nil nil
1371 (if (and transient-mark-mode mark-active) (region-beginning)) 1376 (if (and transient-mark-mode mark-active) (region-beginning))
1372 (if (and transient-mark-mode mark-active) (region-end))))) 1377 (if (and transient-mark-mode mark-active) (region-end))))
1378 (and isearch-recursive-edit (exit-recursive-edit)))
1373 1379
1374(defun isearch-query-replace-regexp (&optional delimited) 1380(defun isearch-query-replace-regexp (&optional delimited)
1375 "Start `query-replace-regexp' with string to replace from last search string. 1381 "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
1384string. NLINES has the same meaning as in `occur'." 1390string. NLINES has the same meaning as in `occur'."
1385 (interactive 1391 (interactive
1386 (list 1392 (list
1387 (if isearch-regexp isearch-string (regexp-quote isearch-string)) 1393 (cond
1394 (isearch-word (concat "\\b" (regexp-quote isearch-string) "\\b"))
1395 (isearch-regexp isearch-string)
1396 (t (regexp-quote isearch-string)))
1388 (if current-prefix-arg (prefix-numeric-value current-prefix-arg)))) 1397 (if current-prefix-arg (prefix-numeric-value current-prefix-arg))))
1389 (let ((case-fold-search isearch-case-fold-search) 1398 (let ((case-fold-search isearch-case-fold-search)
1390 ;; set `search-upper-case' to nil to not call 1399 ;; 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
1401argument from the last search regexp or a quoted search string, 1410argument from the last search regexp or a quoted search string,
1402and reads its face argument using `hi-lock-read-face-name'." 1411and reads its face argument using `hi-lock-read-face-name'."
1403 (interactive) 1412 (interactive)
1404 (isearch-done) 1413 (let (
1405 (isearch-clean-overlays) 1414 ;; Set `isearch-recursive-edit' to nil to prevent calling
1415 ;; `exit-recursive-edit' in `isearch-done' that terminates
1416 ;; the execution of this command when it is non-nil.
1417 ;; We call `exit-recursive-edit' explicitly at the end below.
1418 (isearch-recursive-edit nil))
1419 (isearch-done nil t)
1420 (isearch-clean-overlays))
1406 (require 'hi-lock nil t) 1421 (require 'hi-lock nil t)
1407 (let ((string (cond (isearch-regexp isearch-string) 1422 (let ((string (cond (isearch-regexp isearch-string)
1408 ((if (and (eq isearch-case-fold-search t) 1423 ((if (and (eq isearch-case-fold-search t)
@@ -1420,7 +1435,8 @@ and reads its face argument using `hi-lock-read-face-name'."
1420 (regexp-quote s)))) 1435 (regexp-quote s))))
1421 isearch-string "")) 1436 isearch-string ""))
1422 (t (regexp-quote isearch-string))))) 1437 (t (regexp-quote isearch-string)))))
1423 (hi-lock-face-buffer string (hi-lock-read-face-name)))) 1438 (hi-lock-face-buffer string (hi-lock-read-face-name)))
1439 (and isearch-recursive-edit (exit-recursive-edit)))
1424 1440
1425 1441
1426(defun isearch-delete-char () 1442(defun isearch-delete-char ()