/[emacs]/emacs/lisp/isearch.el
ViewVC logotype

Diff of /emacs/lisp/isearch.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.249 by jurta, Wed Dec 15 10:08:51 2004 UTC revision 1.250 by rms, Tue Jan 4 02:21:55 2005 UTC
# Line 155  command history." Line 155  command history."
155    :type 'boolean    :type 'boolean
156    :group 'isearch)    :group 'isearch)
157    
158    (defcustom isearch-lazy-highlight t
159      "*Controls the lazy-highlighting during incremental search.
160    When non-nil, all text in the buffer matching the current search
161    string is highlighted lazily (see `lazy-highlight-initial-delay'
162    and `lazy-highlight-interval')."
163      :type 'boolean
164      :group 'lazy-highlight
165      :group 'isearch)
166    
167  (defvar isearch-mode-hook nil  (defvar isearch-mode-hook nil
168    "Function(s) to call after starting up an incremental search.")    "Function(s) to call after starting up an incremental search.")
169    
# Line 199  Default value, nil, means edit the strin Line 208  Default value, nil, means edit the strin
208    :type 'boolean    :type 'boolean
209    :group 'isearch)    :group 'isearch)
210    
211    ;;; Lazy highlight customization.
212    (defgroup lazy-highlight nil
213      "Lazy highlighting feature for matching strings."
214      :prefix "lazy-highlight-"
215      :version "21.1"
216      :group 'isearch
217      :group 'replace)
218    
219    (defcustom lazy-highlight-cleanup t
220      "*Controls whether to remove extra highlighting after a search.
221    If this is nil, extra highlighting can be \"manually\" removed with
222    \\[isearch-lazy-highlight-cleanup]."
223      :type 'boolean
224      :group 'lazy-highlight)
225    
226    (defcustom lazy-highlight-initial-delay 0.25
227      "*Seconds to wait before beginning to lazily highlight all matches."
228      :type 'number
229      :group 'lazy-highlight)
230    
231    (defcustom lazy-highlight-interval 0 ; 0.0625
232      "*Seconds between lazily highlighting successive matches."
233      :type 'number
234      :group 'lazy-highlight)
235    
236    (defcustom lazy-highlight-max-at-a-time 20
237      "*Maximum matches to highlight at a time (for `lazy-highlight').
238    Larger values may reduce isearch's responsiveness to user input;
239    smaller values make matches highlight slowly.
240    A value of nil means highlight all matches."
241      :type '(choice (const :tag "All" nil)
242                     (integer :tag "Some"))
243      :group 'lazy-highlight)
244    
245    (defface lazy-highlight-face
246      '((((class color) (min-colors 88) (background light))
247         (:background "paleturquoise"))
248        (((class color) (min-colors 88) (background dark))
249         (:background "paleturquoise4"))
250        (((class color) (min-colors 16))
251         (:background "turquoise3"))
252        (((class color) (min-colors 8))
253         (:background "turquoise3"))
254        (t (:underline t)))
255      "Face for lazy highlighting of matches other than the current one."
256      :group 'isearch-faces
257      :group 'lazy-highlight)
258    
259  ;; Define isearch-mode keymap.  ;; Define isearch-mode keymap.
260    
261  (defvar isearch-mode-map  (defvar isearch-mode-map
# Line 677  is treated as a regexp.  See \\[isearch- Line 734  is treated as a regexp.  See \\[isearch-
734    ;; (setq pre-command-hook isearch-old-pre-command-hook) ; for lemacs    ;; (setq pre-command-hook isearch-old-pre-command-hook) ; for lemacs
735    (setq minibuffer-message-timeout isearch-original-minibuffer-message-timeout)    (setq minibuffer-message-timeout isearch-original-minibuffer-message-timeout)
736    (isearch-dehighlight t)    (isearch-dehighlight t)
737    (isearch-lazy-highlight-cleanup isearch-lazy-highlight-cleanup)    (isearch-lazy-highlight-cleanup lazy-highlight-cleanup)
738    (let ((found-start (window-start (selected-window)))    (let ((found-start (window-start (selected-window)))
739          (found-point (point)))          (found-point (point)))
740      (if isearch-window-configuration      (if isearch-window-configuration
# Line 2227  since they have special meaning in a reg Line 2284  since they have special meaning in a reg
2284  ;;  - the variable `isearch-invalid-regexp' is expected to be true  ;;  - the variable `isearch-invalid-regexp' is expected to be true
2285  ;;    iff `isearch-string' is an invalid regexp.  ;;    iff `isearch-string' is an invalid regexp.
2286    
 (defgroup isearch-lazy-highlight nil  
   "Lazy highlighting feature for incremental search."  
   :prefix "isearch-lazy-highlight-"  
   :version "21.1"  
   :group 'isearch)  
   
 (defcustom isearch-lazy-highlight t  
   "*Controls the lazy-highlighting during incremental searches.  
 When non-nil, all text in the buffer matching the current search  
 string is highlighted lazily (see `isearch-lazy-highlight-initial-delay'  
 and `isearch-lazy-highlight-interval')."  
   :type 'boolean  
   :group 'isearch-lazy-highlight)  
   
 (defcustom isearch-lazy-highlight-cleanup t  
   "*Controls whether to remove extra highlighting after a search.  
 If this is nil, extra highlighting can be \"manually\" removed with  
 \\[isearch-lazy-highlight-cleanup]."  
   :type 'boolean  
   :group 'isearch-lazy-highlight)  
   
 (defcustom isearch-lazy-highlight-initial-delay 0.25  
   "*Seconds to wait before beginning to lazily highlight all matches."  
   :type 'number  
   :group 'isearch-lazy-highlight)  
   
 (defcustom isearch-lazy-highlight-interval 0 ; 0.0625  
   "*Seconds between lazily highlighting successive matches."  
   :type 'number  
   :group 'isearch-lazy-highlight)  
   
 (defcustom isearch-lazy-highlight-max-at-a-time 20  
   "*Maximum matches to highlight at a time (for `isearch-lazy-highlight').  
 Larger values may reduce isearch's responsiveness to user input;  
 smaller values make matches highlight slowly.  
 A value of nil means highlight all matches."  
   :type '(choice (const :tag "All" nil)  
                  (integer :tag "Some"))  
   :group 'isearch-lazy-highlight)  
   
2287  (defgroup isearch-faces nil  (defgroup isearch-faces nil
2288    "Lazy highlighting feature for incremental search."    "Lazy highlighting feature for incremental search."
2289    :version "21.1"    :version "21.1"
# Line 2288  A value of nil means highlight all match Line 2305  A value of nil means highlight all match
2305    :group 'isearch-faces)    :group 'isearch-faces)
2306  (defvar isearch 'isearch)  (defvar isearch 'isearch)
2307    
2308  (defface isearch-lazy-highlight-face  (defvar isearch-lazy-highlight-face 'lazy-highlight-face)
   '((((class color) (min-colors 88) (background light))  
      (:background "paleturquoise"))  
     (((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)  
 (defvar isearch-lazy-highlight-face 'isearch-lazy-highlight-face)  
2309    
2310  (defvar isearch-lazy-highlight-overlays nil)  (defvar isearch-lazy-highlight-overlays nil)
2311  (defvar isearch-lazy-highlight-wrapped nil)  (defvar isearch-lazy-highlight-wrapped nil)
# Line 2316  A value of nil means highlight all match Line 2321  A value of nil means highlight all match
2321    
2322  (defun isearch-lazy-highlight-cleanup (&optional force)  (defun isearch-lazy-highlight-cleanup (&optional force)
2323    "Stop lazy highlighting and remove extra highlighting from current buffer.    "Stop lazy highlighting and remove extra highlighting from current buffer.
2324  FORCE non-nil means do it whether or not `isearch-lazy-highlight-cleanup'  FORCE non-nil means do it whether or not `lazy-highlight-cleanup'
2325  is nil.  This function is called when exiting an incremental search if  is nil.  This function is called when exiting an incremental search if
2326  `isearch-lazy-highlight-cleanup' is non-nil."  `lazy-highlight-cleanup' is non-nil."
2327    (interactive '(t))    (interactive '(t))
2328    (if (or force isearch-lazy-highlight-cleanup)    (if (or force lazy-highlight-cleanup)
2329        (while isearch-lazy-highlight-overlays        (while isearch-lazy-highlight-overlays
2330          (delete-overlay (car isearch-lazy-highlight-overlays))          (delete-overlay (car isearch-lazy-highlight-overlays))
2331          (setq isearch-lazy-highlight-overlays          (setq isearch-lazy-highlight-overlays
# Line 2330  is nil.  This function is called when ex Line 2335  is nil.  This function is called when ex
2335      (setq isearch-lazy-highlight-timer nil)))      (setq isearch-lazy-highlight-timer nil)))
2336    
2337  (defun isearch-lazy-highlight-new-loop ()  (defun isearch-lazy-highlight-new-loop ()
2338    "Cleanup any previous `isearch-lazy-highlight' loop and begin a new one.    "Cleanup any previous `lazy-highlight' loop and begin a new one.
2339  This happens when `isearch-update' is invoked (which can cause the  This happens when `isearch-update' is invoked (which can cause the
2340  search string to change or the window to scroll)."  search string to change or the window to scroll)."
2341    (when (and (null executing-kbd-macro)    (when (and (null executing-kbd-macro)
# Line 2361  search string to change or the window to Line 2366  search string to change or the window to
2366              isearch-lazy-highlight-wrapped      nil)              isearch-lazy-highlight-wrapped      nil)
2367        (unless (equal isearch-string "")        (unless (equal isearch-string "")
2368          (setq isearch-lazy-highlight-timer          (setq isearch-lazy-highlight-timer
2369                (run-with-idle-timer isearch-lazy-highlight-initial-delay nil                (run-with-idle-timer lazy-highlight-initial-delay nil
2370                                     'isearch-lazy-highlight-update))))))                                     'isearch-lazy-highlight-update))))))
2371    
2372  (defun isearch-lazy-highlight-search ()  (defun isearch-lazy-highlight-search ()
# Line 2382  Attempt to do the search exactly the way Line 2387  Attempt to do the search exactly the way
2387    
2388  (defun isearch-lazy-highlight-update ()  (defun isearch-lazy-highlight-update ()
2389    "Update highlighting of other matches for current search."    "Update highlighting of other matches for current search."
2390    (let ((max isearch-lazy-highlight-max-at-a-time)    (let ((max lazy-highlight-max-at-a-time)
2391          (looping t)          (looping t)
2392          nomore)          nomore)
2393      (with-local-quit      (with-local-quit

Legend:
Removed from v.1.249  
changed lines
  Added in v.1.250

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26