comparison lisp/isearch-mode.el @ 373:6240c7796c7a r21-2b2

Import from CVS: tag r21-2b2
author cvs
date Mon, 13 Aug 2007 11:04:06 +0200
parents cc15677e0335
children a300bb07d72d
comparison
equal deleted inserted replaced
372:49e1ed2d7ed8 373:6240c7796c7a
457 isearch-just-started t 457 isearch-just-started t
458 458
459 isearch-opoint (point) 459 isearch-opoint (point)
460 isearch-window-configuration (current-window-configuration) 460 isearch-window-configuration (current-window-configuration)
461 461
462 ;; #### - don't do this statically: isearch-mode must be FIRST in 462 ;; #### Should we remember the old value of
463 ;; the minor-mode-map-alist -- Stig 463 ;; overriding-local-map?
464 minor-mode-map-alist (cons (cons 'isearch-mode isearch-mode-map) 464 overriding-local-map isearch-mode-map
465 minor-mode-map-alist)
466 isearch-selected-frame (selected-frame) 465 isearch-selected-frame (selected-frame)
467 466
468 isearch-mode (gettext " Isearch") 467 isearch-mode (gettext " Isearch")
469 ) 468 )
470 469
539 ;; Some loser process filter might have switched the 538 ;; Some loser process filter might have switched the
540 ;; window's buffer, so be sure to set these variables back 539 ;; window's buffer, so be sure to set these variables back
541 ;; in the buffer we frobbed them in. But only if the buffer 540 ;; in the buffer we frobbed them in. But only if the buffer
542 ;; is still alive. 541 ;; is still alive.
543 (set-buffer isearch-buffer) 542 (set-buffer isearch-buffer)
544 (setq minor-mode-map-alist (delq (assoc 'isearch-mode minor-mode-map-alist) 543 ;; #### Should we restore the old value of
545 minor-mode-map-alist)) 544 ;; overriding-local-map?
545 (setq overriding-local-map nil)
546 ;; Use remove-hook instead of just setting it to our saved value 546 ;; Use remove-hook instead of just setting it to our saved value
547 ;; in case some process filter has created a buffer and modified 547 ;; in case some process filter has created a buffer and modified
548 ;; the pre-command-hook in that buffer... yeah, this is obscure, 548 ;; the pre-command-hook in that buffer... yeah, this is obscure,
549 ;; and yeah, I was getting screwed by it. -jwz 549 ;; and yeah, I was getting screwed by it. -jwz
550 (remove-hook 'pre-command-hook 'isearch-pre-command-hook) 550 (remove-hook 'pre-command-hook 'isearch-pre-command-hook)
934 (defun isearch-yank-x-clipboard () 934 (defun isearch-yank-x-clipboard ()
935 "Pull the current X clipboard selection into the search string." 935 "Pull the current X clipboard selection into the search string."
936 (interactive) 936 (interactive)
937 (isearch-yank (x-get-clipboard))) 937 (isearch-yank (x-get-clipboard)))
938 938
939 (defun isearch-fix-case ()
940 (if (and isearch-case-fold-search search-caps-disable-folding)
941 (setq isearch-case-fold-search (isearch-no-upper-case-p isearch-string)))
942 (setq isearch-mode (if case-fold-search
943 (if isearch-case-fold-search
944 " Isearch" ;As God Intended Mode
945 " ISeARch") ;Warn about evil case via StuDLYcAps.
946 "Isearch"
947 ; (if isearch-case-fold-search
948 ; " isearch" ;Presumably case-sensitive losers
949 ; ;will notice this 1-char difference.
950 ; " Isearch") ;Weenie mode.
951 )))
952
939 (defun isearch-search-and-update () 953 (defun isearch-search-and-update ()
940 ;; Do the search and update the display. 954 ;; Do the search and update the display.
941 (if (and (not isearch-success) 955 (if (and (not isearch-success)
942 ;; unsuccessful regexp search may become 956 ;; unsuccessful regexp search may become
943 ;; successful by addition of characters which 957 ;; successful by addition of characters which
949 ;; matched, in the string following point. 963 ;; matched, in the string following point.
950 ;; Allow all those possibilities without moving point as 964 ;; Allow all those possibilities without moving point as
951 ;; long as the match does not extend past search origin. 965 ;; long as the match does not extend past search origin.
952 (if (and (not isearch-forward) (not isearch-adjusted) 966 (if (and (not isearch-forward) (not isearch-adjusted)
953 (condition-case () 967 (condition-case ()
954 (looking-at (if isearch-regexp isearch-string 968 (progn
955 (regexp-quote isearch-string))) 969 (isearch-fix-case)
970 (let ((case-fold-search isearch-case-fold-search))
971 (looking-at (if isearch-regexp isearch-string
972 (regexp-quote isearch-string)))))
956 (error nil)) 973 (error nil))
957 (or isearch-yank-flag 974 (or isearch-yank-flag
958 (<= (match-end 0) 975 (<= (match-end 0)
959 (min isearch-opoint isearch-barrier)))) 976 (min isearch-opoint isearch-barrier))))
960 (setq isearch-success t 977 (setq isearch-success t
961 isearch-invalid-regexp nil 978 isearch-invalid-regexp nil
962 isearch-other-end (match-end 0)) 979 isearch-other-end (match-end 0))
963 ;; Not regexp, not reverse, or no match at point. 980 ;; Not regexp, not reverse, or no match at point.
964 (if (and isearch-other-end (not isearch-adjusted)) 981 (if (and isearch-other-end (not isearch-adjusted))
1458 1475
1459 (defun isearch-highlight (begin end) 1476 (defun isearch-highlight (begin end)
1460 (if (null isearch-highlight) 1477 (if (null isearch-highlight)
1461 nil 1478 nil
1462 ;; make sure isearch-extent is in the current buffer 1479 ;; make sure isearch-extent is in the current buffer
1463 (cond ((not (extentp isearch-extent)) 1480 (or (extentp isearch-extent)
1464 (isearch-make-extent begin end)) 1481 (isearch-make-extent begin end))
1465 ((not (eq (extent-object isearch-extent) (current-buffer))) 1482 (set-extent-endpoints isearch-extent begin end (current-buffer))))
1466 (delete-extent isearch-extent)
1467 (isearch-make-extent begin end)))
1468 (set-extent-endpoints isearch-extent begin end)))
1469 1483
1470 (defun isearch-dehighlight (totally) 1484 (defun isearch-dehighlight (totally)
1471 (if (and isearch-highlight isearch-extent) 1485 (if (and isearch-highlight isearch-extent)
1472 (if totally 1486 (if totally
1473 (let ((inhibit-quit t)) 1487 (let ((inhibit-quit t))
1483 ;;; Searching 1497 ;;; Searching
1484 1498
1485 (defun isearch-search () 1499 (defun isearch-search ()
1486 ;; Do the search with the current search string. 1500 ;; Do the search with the current search string.
1487 (isearch-message nil t) 1501 (isearch-message nil t)
1488 (if (and isearch-case-fold-search search-caps-disable-folding) 1502 (isearch-fix-case)
1489 (setq isearch-case-fold-search (isearch-no-upper-case-p isearch-string)))
1490
1491 (setq isearch-mode (if case-fold-search
1492 (if isearch-case-fold-search
1493 " Isearch" ;As God Intended Mode
1494 " ISeARch") ;Warn about evil case via StuDLYcAps.
1495 "Isearch"
1496 ; (if isearch-case-fold-search
1497 ; " isearch" ;Presumably case-sensitive losers
1498 ; ;will notice this 1-char difference.
1499 ; " Isearch") ;Weenie mode.
1500 ))
1501 (condition-case lossage 1503 (condition-case lossage
1502 (let ((inhibit-quit nil) 1504 (let ((inhibit-quit nil)
1503 (case-fold-search isearch-case-fold-search)) 1505 (case-fold-search isearch-case-fold-search))
1504 (if isearch-regexp (setq isearch-invalid-regexp nil)) 1506 (if isearch-regexp (setq isearch-invalid-regexp nil))
1505 (setq isearch-success 1507 (setq isearch-success