comparison lisp/isearch-mode.el @ 375:a300bb07d72d r21-2b3

Import from CVS: tag r21-2b3
author cvs
date Mon, 13 Aug 2007 11:04:51 +0200
parents 6240c7796c7a
children d883f39b8495
comparison
equal deleted inserted replaced
374:4ebeb1a5388b 375:a300bb07d72d
144 (defcustom search-slow-speed 1200 144 (defcustom search-slow-speed 1200
145 "*Highest terminal speed at which to use \"slow\" style incremental search. 145 "*Highest terminal speed at which to use \"slow\" style incremental search.
146 This is the style where a one-line window is created to show the line 146 This is the style where a one-line window is created to show the line
147 that the search has reached." 147 that the search has reached."
148 :type 'integer 148 :type 'integer
149 :group 'isearch)
150
151 (defcustom search-caps-disable-folding t
152 "*If non-nil, upper case chars disable case fold searching.
153 This does not apply to \"yanked\" strings."
154 :type 'boolean
155 :group 'isearch) 149 :group 'isearch)
156 150
157 (defcustom search-nonincremental-instead t 151 (defcustom search-nonincremental-instead t
158 "*If non-nil, do a nonincremental search instead if exiting immediately." 152 "*If non-nil, do a nonincremental search instead if exiting immediately."
159 :type 'boolean 153 :type 'boolean
585 (progn 579 (progn
586 (setq regexp-search-ring 580 (setq regexp-search-ring
587 (cons isearch-string regexp-search-ring) 581 (cons isearch-string regexp-search-ring)
588 regexp-search-ring-yank-pointer regexp-search-ring) 582 regexp-search-ring-yank-pointer regexp-search-ring)
589 (if (> (length regexp-search-ring) regexp-search-ring-max) 583 (if (> (length regexp-search-ring) regexp-search-ring-max)
590 (setcdr (nthcdr (1- search-ring-max) regexp-search-ring) 584 (setcdr (nthcdr (1- regexp-search-ring-max) regexp-search-ring)
591 nil)))) 585 nil))))
592 (if (not (setq search-ring-yank-pointer 586 (if (not (setq search-ring-yank-pointer
593 ;; really need equal test instead of eq. 587 ;; really need equal test instead of eq.
594 (member isearch-string search-ring))) 588 (member isearch-string search-ring)))
595 (progn 589 (progn
936 (interactive) 930 (interactive)
937 (isearch-yank (x-get-clipboard))) 931 (isearch-yank (x-get-clipboard)))
938 932
939 (defun isearch-fix-case () 933 (defun isearch-fix-case ()
940 (if (and isearch-case-fold-search search-caps-disable-folding) 934 (if (and isearch-case-fold-search search-caps-disable-folding)
941 (setq isearch-case-fold-search (isearch-no-upper-case-p isearch-string))) 935 (setq isearch-case-fold-search
936 (no-upper-case-p isearch-string isearch-regexp)))
942 (setq isearch-mode (if case-fold-search 937 (setq isearch-mode (if case-fold-search
943 (if isearch-case-fold-search 938 (if isearch-case-fold-search
944 " Isearch" ;As God Intended Mode 939 " Isearch" ;As God Intended Mode
945 " ISeARch") ;Warn about evil case via StuDLYcAps. 940 " ISeARch") ;Warn about evil case via StuDLYcAps.
946 "Isearch" 941 "Isearch"
1596 ; (setq command-history 1591 ; (setq command-history
1597 ; (cons (list function isearch-string) command-history)) 1592 ; (cons (list function isearch-string) command-history))
1598 ; ;; Go ahead and search. 1593 ; ;; Go ahead and search.
1599 ; (if search-caps-disable-folding 1594 ; (if search-caps-disable-folding
1600 ; (setq isearch-case-fold-search 1595 ; (setq isearch-case-fold-search
1601 ; (isearch-no-upper-case-p isearch-string))) 1596 ; (no-upper-case-p isearch-string isearch-regexp)))
1602 ; (let ((case-fold-search isearch-case-fold-search)) 1597 ; (let ((case-fold-search isearch-case-fold-search))
1603 ; (funcall function isearch-string)))) 1598 ; (funcall function isearch-string))))
1604
1605 1599
1606 (defun isearch-no-upper-case-p (string) 1600 (defun isearch-no-upper-case-p (string)
1607 "Return t if there are no upper case chars in string. 1601 "Return t if there are no upper case chars in string.
1608 But upper case chars preceded by \\ do not count since they 1602 But upper case chars preceded by \\ do not count since they
1609 have special meaning in a regexp." 1603 have special meaning in a regexp."
1610 ;; this incorrectly returns t for "\\\\A" 1604 ;; this incorrectly returns t for "\\\\A"
1611 (let ((case-fold-search nil)) 1605 (let ((case-fold-search nil))
1612 (not (string-match "\\(^\\|[^\\]\\)[A-Z]" string)))) 1606 (not (string-match "\\(^\\|[^\\]\\)[A-Z]" string))))
1607 (make-obsolete 'isearch-no-upper-case-p 'no-upper-case-p)
1613 1608
1614 ;; Used by etags.el and info.el 1609 ;; Used by etags.el and info.el
1615 (defmacro with-caps-disable-folding (string &rest body) "\ 1610 (defmacro with-caps-disable-folding (string &rest body) "\
1616 Eval BODY with `case-fold-search' let to nil if STRING contains 1611 Eval BODY with `case-fold-search' let to nil if STRING contains
1617 uppercase letters and `search-caps-disable-folding' is t." 1612 uppercase letters and `search-caps-disable-folding' is t."
1618 `(let ((case-fold-search 1613 `(let ((case-fold-search
1619 (if (and case-fold-search search-caps-disable-folding) 1614 (if (and case-fold-search search-caps-disable-folding)
1620 (isearch-no-upper-case-p ,string) 1615 (isearch-no-upper-case-p ,string)
1621 case-fold-search))) 1616 case-fold-search)))
1622 ,@body)) 1617 ,@body))
1618 (make-obsolete 'with-caps-disable-folding 'with-search-caps-disable-folding)
1623 (put 'with-caps-disable-folding 'lisp-indent-function 1) 1619 (put 'with-caps-disable-folding 'lisp-indent-function 1)
1624 (put 'with-caps-disable-folding 'edebug-form-spec '(form body)) 1620 (put 'with-caps-disable-folding 'edebug-form-spec '(form body))
1625 1621
1626 ;;; isearch-mode.el ends here 1622 ;;; isearch-mode.el ends here