Mercurial > hg > xemacs-beta
comparison lisp/isearch-mode.el @ 371:cc15677e0335 r21-2b1
Import from CVS: tag r21-2b1
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:03:08 +0200 |
parents | 19dcec799385 |
children | 6240c7796c7a |
comparison
equal
deleted
inserted
replaced
370:bd866891f083 | 371:cc15677e0335 |
---|---|
585 (progn | 585 (progn |
586 (setq regexp-search-ring | 586 (setq regexp-search-ring |
587 (cons isearch-string regexp-search-ring) | 587 (cons isearch-string regexp-search-ring) |
588 regexp-search-ring-yank-pointer regexp-search-ring) | 588 regexp-search-ring-yank-pointer regexp-search-ring) |
589 (if (> (length regexp-search-ring) regexp-search-ring-max) | 589 (if (> (length regexp-search-ring) regexp-search-ring-max) |
590 (setcdr (nthcdr (1- regexp-search-ring-max) regexp-search-ring) | 590 (setcdr (nthcdr (1- search-ring-max) regexp-search-ring) |
591 nil)))) | 591 nil)))) |
592 (if (not (setq search-ring-yank-pointer | 592 (if (not (setq search-ring-yank-pointer |
593 ;; really need equal test instead of eq. | 593 ;; really need equal test instead of eq. |
594 (member isearch-string search-ring))) | 594 (member isearch-string search-ring))) |
595 (progn | 595 (progn |
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 | |
953 (defun isearch-search-and-update () | 939 (defun isearch-search-and-update () |
954 ;; Do the search and update the display. | 940 ;; Do the search and update the display. |
955 (if (and (not isearch-success) | 941 (if (and (not isearch-success) |
956 ;; unsuccessful regexp search may become | 942 ;; unsuccessful regexp search may become |
957 ;; successful by addition of characters which | 943 ;; successful by addition of characters which |
963 ;; matched, in the string following point. | 949 ;; matched, in the string following point. |
964 ;; Allow all those possibilities without moving point as | 950 ;; Allow all those possibilities without moving point as |
965 ;; long as the match does not extend past search origin. | 951 ;; long as the match does not extend past search origin. |
966 (if (and (not isearch-forward) (not isearch-adjusted) | 952 (if (and (not isearch-forward) (not isearch-adjusted) |
967 (condition-case () | 953 (condition-case () |
968 (progn | 954 (looking-at (if isearch-regexp isearch-string |
969 (isearch-fix-case) | 955 (regexp-quote isearch-string))) |
970 (let ((case-fold-search isearch-case-fold-search)) | |
971 (looking-at (if isearch-regexp isearch-string | |
972 (regexp-quote isearch-string))))) | |
973 (error nil)) | 956 (error nil)) |
974 (or isearch-yank-flag | 957 (or isearch-yank-flag |
975 (<= (match-end 0) | 958 (<= (match-end 0) |
976 (min isearch-opoint isearch-barrier)))) | 959 (min isearch-opoint isearch-barrier)))) |
977 (setq isearch-success t | 960 (setq isearch-success t |
978 isearch-invalid-regexp nil | 961 isearch-invalid-regexp nil |
979 isearch-other-end (match-end 0)) | 962 isearch-other-end (match-end 0)) |
980 ;; Not regexp, not reverse, or no match at point. | 963 ;; Not regexp, not reverse, or no match at point. |
981 (if (and isearch-other-end (not isearch-adjusted)) | 964 (if (and isearch-other-end (not isearch-adjusted)) |
1475 | 1458 |
1476 (defun isearch-highlight (begin end) | 1459 (defun isearch-highlight (begin end) |
1477 (if (null isearch-highlight) | 1460 (if (null isearch-highlight) |
1478 nil | 1461 nil |
1479 ;; make sure isearch-extent is in the current buffer | 1462 ;; make sure isearch-extent is in the current buffer |
1480 (or (extentp isearch-extent) | 1463 (cond ((not (extentp isearch-extent)) |
1481 (isearch-make-extent begin end)) | 1464 (isearch-make-extent begin end)) |
1482 (set-extent-endpoints isearch-extent begin end (current-buffer)))) | 1465 ((not (eq (extent-object isearch-extent) (current-buffer))) |
1466 (delete-extent isearch-extent) | |
1467 (isearch-make-extent begin end))) | |
1468 (set-extent-endpoints isearch-extent begin end))) | |
1483 | 1469 |
1484 (defun isearch-dehighlight (totally) | 1470 (defun isearch-dehighlight (totally) |
1485 (if (and isearch-highlight isearch-extent) | 1471 (if (and isearch-highlight isearch-extent) |
1486 (if totally | 1472 (if totally |
1487 (let ((inhibit-quit t)) | 1473 (let ((inhibit-quit t)) |
1497 ;;; Searching | 1483 ;;; Searching |
1498 | 1484 |
1499 (defun isearch-search () | 1485 (defun isearch-search () |
1500 ;; Do the search with the current search string. | 1486 ;; Do the search with the current search string. |
1501 (isearch-message nil t) | 1487 (isearch-message nil t) |
1502 (isearch-fix-case) | 1488 (if (and isearch-case-fold-search search-caps-disable-folding) |
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 )) | |
1503 (condition-case lossage | 1501 (condition-case lossage |
1504 (let ((inhibit-quit nil) | 1502 (let ((inhibit-quit nil) |
1505 (case-fold-search isearch-case-fold-search)) | 1503 (case-fold-search isearch-case-fold-search)) |
1506 (if isearch-regexp (setq isearch-invalid-regexp nil)) | 1504 (if isearch-regexp (setq isearch-invalid-regexp nil)) |
1507 (setq isearch-success | 1505 (setq isearch-success |