comparison lisp/isearch-mode.el @ 318:afd57c14dfc8 r21-0b57

Import from CVS: tag r21-0b57
author cvs
date Mon, 13 Aug 2007 10:45:36 +0200
parents c5d627a313b1
children 19dcec799385
comparison
equal deleted inserted replaced
317:a2fc9afbef65 318:afd57c14dfc8
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