aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuri Linkov2004-12-12 21:53:14 +0000
committerJuri Linkov2004-12-12 21:53:14 +0000
commit6ee8e6218d7dd2370653b0a76659391ff93dca6f (patch)
treeb71c7a0bd18010fe1d5917da745d79c24a5376fb
parent24a0e22f86e543d3b1b75836f524635d6b99cd99 (diff)
downloademacs-6ee8e6218d7dd2370653b0a76659391ff93dca6f.tar.gz
emacs-6ee8e6218d7dd2370653b0a76659391ff93dca6f.zip
(isearch-edit-string): Set 7th arg of
`read-from-minibuffer' to `t' to inherit the current input method (whose name is indicated by [IM] in the minibuffer prompt) from the current buffer to the minibuffer. (isearch-lazy-highlight-update): Put body to `with-local-quit' to allow C-g quitting for lazy highlighting looping inside the search with nested repetition operators. Add overlay to the list before setting its face and other properties to avoid the case of code quitting after placing the new overlay but before it's recorded on the list. Select the window where isearch was activated, to highlight matches in the right window when isearch switches the current window to the minibuffer.
-rw-r--r--lisp/isearch.el111
1 files changed, 58 insertions, 53 deletions
diff --git a/lisp/isearch.el b/lisp/isearch.el
index d138f72cf56..9ee9b4d8521 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -943,7 +943,7 @@ If first char entered is \\[isearch-yank-word-or-char], then do word search inst
943 (isearch-message-prefix nil nil isearch-nonincremental) 943 (isearch-message-prefix nil nil isearch-nonincremental)
944 isearch-string 944 isearch-string
945 minibuffer-local-isearch-map nil 945 minibuffer-local-isearch-map nil
946 'junk-ring)) 946 'junk-ring nil t))
947 isearch-new-message 947 isearch-new-message
948 (mapconcat 'isearch-text-char-description 948 (mapconcat 'isearch-text-char-description
949 isearch-new-string ""))) 949 isearch-new-string "")))
@@ -2386,59 +2386,64 @@ Attempt to do the search exactly the way the pending isearch would."
2386 (let ((max isearch-lazy-highlight-max-at-a-time) 2386 (let ((max isearch-lazy-highlight-max-at-a-time)
2387 (looping t) 2387 (looping t)
2388 nomore) 2388 nomore)
2389 (save-excursion 2389 (with-local-quit
2390 (save-match-data 2390 (save-selected-window
2391 (goto-char (if isearch-forward 2391 (if (and (window-live-p isearch-lazy-highlight-window)
2392 isearch-lazy-highlight-end 2392 (not (eq (selected-window) isearch-lazy-highlight-window)))
2393 isearch-lazy-highlight-start)) 2393 (select-window isearch-lazy-highlight-window))
2394 (while looping 2394 (save-excursion
2395 (let ((found (isearch-lazy-highlight-search))) 2395 (save-match-data
2396 (when max 2396 (goto-char (if isearch-forward
2397 (setq max (1- max)) 2397 isearch-lazy-highlight-end
2398 (if (<= max 0) 2398 isearch-lazy-highlight-start))
2399 (setq looping nil))) 2399 (while looping
2400 (if found 2400 (let ((found (isearch-lazy-highlight-search)))
2401 (let ((mb (match-beginning 0)) 2401 (when max
2402 (me (match-end 0))) 2402 (setq max (1- max))
2403 (if (= mb me) ;zero-length match 2403 (if (<= max 0)
2404 (setq looping nil)))
2405 (if found
2406 (let ((mb (match-beginning 0))
2407 (me (match-end 0)))
2408 (if (= mb me) ;zero-length match
2409 (if isearch-forward
2410 (if (= mb (if isearch-lazy-highlight-wrapped
2411 isearch-lazy-highlight-start
2412 (window-end)))
2413 (setq found nil)
2414 (forward-char 1))
2415 (if (= mb (if isearch-lazy-highlight-wrapped
2416 isearch-lazy-highlight-end
2417 (window-start)))
2418 (setq found nil)
2419 (forward-char -1)))
2420
2421 ;; non-zero-length match
2422 (let ((ov (make-overlay mb me)))
2423 (push ov isearch-lazy-highlight-overlays)
2424 (overlay-put ov 'face isearch-lazy-highlight-face)
2425 (overlay-put ov 'priority 0) ;lower than main overlay
2426 (overlay-put ov 'window (selected-window))))
2427 (if isearch-forward
2428 (setq isearch-lazy-highlight-end (point))
2429 (setq isearch-lazy-highlight-start (point)))))
2430
2431 ;; not found or zero-length match at the search bound
2432 (if (not found)
2433 (if isearch-lazy-highlight-wrapped
2434 (setq looping nil
2435 nomore t)
2436 (setq isearch-lazy-highlight-wrapped t)
2404 (if isearch-forward 2437 (if isearch-forward
2405 (if (= mb (if isearch-lazy-highlight-wrapped 2438 (progn
2406 isearch-lazy-highlight-start 2439 (setq isearch-lazy-highlight-end (window-start))
2407 (window-end))) 2440 (goto-char (window-start)))
2408 (setq found nil) 2441 (setq isearch-lazy-highlight-start (window-end))
2409 (forward-char 1)) 2442 (goto-char (window-end)))))))
2410 (if (= mb (if isearch-lazy-highlight-wrapped 2443 (unless nomore
2411 isearch-lazy-highlight-end 2444 (setq isearch-lazy-highlight-timer
2412 (window-start))) 2445 (run-at-time isearch-lazy-highlight-interval nil
2413 (setq found nil) 2446 'isearch-lazy-highlight-update)))))))))
2414 (forward-char -1)))
2415
2416 ;; non-zero-length match
2417 (let ((ov (make-overlay mb me)))
2418 (overlay-put ov 'face isearch-lazy-highlight-face)
2419 (overlay-put ov 'priority 0) ;lower than main overlay
2420 (overlay-put ov 'window (selected-window))
2421 (push ov isearch-lazy-highlight-overlays)))
2422 (if isearch-forward
2423 (setq isearch-lazy-highlight-end (point))
2424 (setq isearch-lazy-highlight-start (point)))))
2425
2426 ;; not found or zero-length match at the search bound
2427 (if (not found)
2428 (if isearch-lazy-highlight-wrapped
2429 (setq looping nil
2430 nomore t)
2431 (setq isearch-lazy-highlight-wrapped t)
2432 (if isearch-forward
2433 (progn
2434 (setq isearch-lazy-highlight-end (window-start))
2435 (goto-char (window-start)))
2436 (setq isearch-lazy-highlight-start (window-end))
2437 (goto-char (window-end)))))))
2438 (unless nomore
2439 (setq isearch-lazy-highlight-timer
2440 (run-at-time isearch-lazy-highlight-interval nil
2441 'isearch-lazy-highlight-update)))))))
2442 2447
2443(defun isearch-resume (search regexp word forward message case-fold) 2448(defun isearch-resume (search regexp word forward message case-fold)
2444 "Resume an incremental search. 2449 "Resume an incremental search.