]> code.delx.au - gnu-emacs/blobdiff - lisp/isearch.el
*** empty log message ***
[gnu-emacs] / lisp / isearch.el
index d84510eb7a23a1c1e5d72a62b7473a35a000f721..91a2c34870dab107206437d1f1f0bf2a9c0feedd 100644 (file)
@@ -1,6 +1,6 @@
 ;;; isearch.el --- incremental search minor mode
 
-;; Copyright (C) 1992, 93, 94, 95, 96, 97, 1999, 2000, 01, 2003
+;; Copyright (C) 1992, 93, 94, 95, 96, 97, 1999, 2000, 01, 2003, 2004
 ;;   Free Software Foundation, Inc.
 
 ;; Author: Daniel LaLiberte <liberte@cs.uiuc.edu>
@@ -301,6 +301,7 @@ Default value, nil, means edit the string instead."
     ;; Nothing special for + because it matches at least once.
     (define-key map "*" 'isearch-*-char)
     (define-key map "?" 'isearch-*-char)
+    (define-key map "{" 'isearch-{-char)
     (define-key map "|" 'isearch-|-char)
 
     ;; Turned off because I find I expect to get the global definition--rms.
@@ -1186,21 +1187,30 @@ might return the position of the end of the line."
   (isearch-update))
 
 
+(defun isearch-{-char ()
+  "Handle \{ specially in regexps."
+  (interactive)
+  (isearch-*-char t))
+
 ;; *, ?, and | chars can make a regexp more liberal.
 ;; They can make a regexp match sooner or make it succeed instead of failing.
 ;; So go back to place last successful search started
 ;; or to the last ^S/^R (barrier), whichever is nearer.
 ;; + needs no special handling because the string must match at least once.
 
-(defun isearch-*-char ()
-  "Handle * and ? specially in regexps."
+(defun isearch-*-char (&optional want-backslash)
+  "Handle * and ? specially in regexps.
+When WANT-BACKSLASH is non-nil, do special handling for \{."
   (interactive)
   (if isearch-regexp
       (let ((idx (length isearch-string)))
        (while (and (> idx 0)
                    (eq (aref isearch-string (1- idx)) ?\\))
          (setq idx (1- idx)))
-       (when (= (mod (- (length isearch-string) idx) 2) 0)
+       ;; * and ? are special when not preceded by \.
+       ;; { is special when it is preceded by \.
+       (when (= (mod (- (length isearch-string) idx) 2)
+                (if want-backslash 1 0))
          (setq isearch-adjusted t)
          ;; Get the isearch-other-end from before the last search.
          ;; We want to start from there,
@@ -2128,26 +2138,30 @@ A value of nil means highlight all matches."
   :group 'isearch)
 
 (defface isearch
-  '((((type tty pc) (class color))
-     (:background "magenta4" :foreground "cyan1"))
-    (((class color) (background light))
+  '((((class color) (min-colors 88) (background light))
      ;; The background must not be too dark, for that means
      ;; the character is hard to see when the cursor is there.
      (:background "magenta2" :foreground "lightskyblue1"))
-    (((class color) (background dark))
+    (((class color) (min-colors 88) (background dark))
      (:background "palevioletred2" :foreground "brown4"))
+    (((class color) (min-colors 16))
+     (:background "magenta4" :foreground "cyan1"))
+    (((class color) (min-colors 8))
+     (:background "magenta4" :foreground "cyan1"))
     (t (:inverse-video t)))
   "Face for highlighting Isearch matches."
   :group 'isearch-faces)
 (defvar isearch 'isearch)
 
 (defface isearch-lazy-highlight-face
-  '((((type tty pc) (class color))
-     (:background "turquoise3"))
-    (((class color) (background light))
+  '((((class color) (min-colors 88) (background light))
      (:background "paleturquoise"))
-    (((class color) (background dark))
+    (((class color) (min-colors 88) (background dark))
      (:background "paleturquoise4"))
+    (((class color) (min-colors 16))
+     (:background "turquoise3"))
+    (((class color) (min-colors 8))
+     (:background "turquoise3"))
     (t (:underline t)))
   "Face for lazy highlighting of Isearch matches other than the current one."
   :group 'isearch-faces)