Mercurial > hg > xemacs-beta
diff lisp/isearch-mode.el @ 5855:0bddb59072b6
Look for cased character classes when deciding on case-fold-search, #'isearch
lisp/ChangeLog addition:
2015-03-11 Aidan Kehoe <kehoea@parhasard.net>
* isearch-mode.el:
* isearch-mode.el (isearch-fix-case):
Use the new #'no-case-regexp-p function if treating ISEARCH-STRING
as a regular expression; otherwise, use the [[:upper:]] character
class.
* isearch-mode.el (isearch-no-upper-case-p): Removed.
* isearch-mode.el (with-caps-disable-folding): Removed.
These two haven't been used since 1998.
* occur.el (occur-1):
Use #'no-case-regexp-p here.
* replace.el (perform-replace):
Don't use #'no-upper-case-p, use #'no-case-regexp-p or
(string-match "[[:upper:]]" ...) as appropriate.
* simple.el:
* simple.el (no-upper-case-p): Removed. This did two different
things, and its secondary function (examining regular expressions)
just became much more complicated; move the regular expression
functionality to its own function, use character classes when
examining non-regular-expressions instead.
The code to look for character classes, and the design decision
that this should be done, are from GNU, thank you Stefan Monnier.
* simple.el (no-case-regexp-p): New.
Given a REGEXP, return non-nil if it has nothing to suggest an
interactive user wants a case-sensitive search.
* simple.el (with-search-caps-disable-folding):
* simple.el (with-interactive-search-caps-disable-folding):
Update both these macros to use #'no-case-regexp-p.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Wed, 11 Mar 2015 18:06:15 +0000 |
parents | 2b8edd304c2b |
children |
line wrap: on
line diff
--- a/lisp/isearch-mode.el Wed Mar 11 15:06:05 2015 +0000 +++ b/lisp/isearch-mode.el Wed Mar 11 18:06:15 2015 +0000 @@ -1068,7 +1068,11 @@ (not isearch-fixed-case) search-caps-disable-folding) (setq isearch-case-fold-search - (no-upper-case-p isearch-string isearch-regexp))) + (if isearch-regexp + (no-case-regexp-p isearch-string) + (save-match-data + (let (case-fold-search) + (not (string-match "[[:upper:]]" isearch-string))))))) (setq isearch-mode (if case-fold-search (if isearch-case-fold-search " Isearch" ;As God Intended Mode @@ -1856,15 +1860,6 @@ t)) isearch-unhidden-extents))))) -(defun isearch-no-upper-case-p (string) - "Return t if there are no upper case chars in string. -But upper case chars preceded by \\ do not count since they -have special meaning in a regexp." - ;; this incorrectly returns t for "\\\\A" - (let ((case-fold-search nil)) - (not (string-match "\\(^\\|[^\\]\\)[A-Z]" string)))) -(make-obsolete 'isearch-no-upper-case-p 'no-upper-case-p) - ;; Portability functions to support various Emacs versions. (defun isearch-char-to-string (c) @@ -1876,20 +1871,6 @@ ; (isearch-char-to-string c)) (define-function 'isearch-text-char-description 'text-char-description) - -;; Used by etags.el and info.el -(defmacro with-caps-disable-folding (string &rest body) "\ -Eval BODY with `case-fold-search' let to nil if STRING contains -uppercase letters and `search-caps-disable-folding' is t." - `(let ((case-fold-search - (if (and case-fold-search search-caps-disable-folding) - (isearch-no-upper-case-p ,string) - case-fold-search))) - ,@body)) -(make-obsolete 'with-caps-disable-folding 'with-search-caps-disable-folding) -(put 'with-caps-disable-folding 'lisp-indent-function 1) -(put 'with-caps-disable-folding 'edebug-form-spec '(form body)) - ;;;======================================================== ;;; Advanced highlighting