Here is the patch for it to work with itimers. It could probably be
coded better (e.g. using the RESTART feature of itimers), but this
should do for starters.
The feature could probably be improved (more about that later), but
it's quite nice even as it is.
--- isearch-mode.el.orig Wed Jul 28 04:15:59 1999
+++ isearch-mode.el Wed Jul 28 04:16:03 1999
@@ -1677,8 +1677,6 @@
;;; - the variable `isearch-invalid-regexp' is expected to be true
;;; iff `isearch-string' is an invalid regexp.
-(require 'timer)
-
(defgroup isearch-lazy-highlight nil
"Lazy highlighting feature for incremental search."
:prefix "isearch-lazy-highlight-"
@@ -1731,7 +1729,7 @@
(isearch-lazy-highlight-remove-extents))
(if isearch-lazy-highlight-timer
(progn
- (cancel-timer isearch-lazy-highlight-timer)
+ (delete-itimer isearch-lazy-highlight-timer)
(setq isearch-lazy-highlight-timer nil))))
(defun isearch-lazy-highlight-remove-extents ()
@@ -1759,8 +1757,10 @@
isearch-lazy-highlight-last-string isearch-string
isearch-lazy-highlight-wrapped nil)
(setq isearch-lazy-highlight-timer
- (run-with-idle-timer isearch-lazy-highlight-initial-delay nil
- 'isearch-lazy-highlight-update)))))
+ (start-itimer "Lazy highlight"
+ 'isearch-lazy-highlight-update
+ isearch-lazy-highlight-initial-delay
+ nil t)))))
(defun isearch-lazy-highlight-search ()
"Search ahead for the next or previous match, for lazy highlighting.
@@ -1805,8 +1805,10 @@
(setq isearch-lazy-highlight-extents
(cons ext isearch-lazy-highlight-extents))
(setq isearch-lazy-highlight-timer
- (run-at-time isearch-lazy-highlight-interval nil
- 'isearch-lazy-highlight-update))
+ (start-itimer "Lazy highlight"
+ 'isearch-lazy-highlight-update
+ isearch-lazy-highlight-interval
+ nil t))
(if isearch-forward
(setq isearch-lazy-highlight-end (point))
(setq isearch-lazy-highlight-start (point))))
@@ -1815,8 +1817,10 @@
;; let's try wrapping around the end of the buffer
(setq isearch-lazy-highlight-wrapped t)
(setq isearch-lazy-highlight-timer
- (run-at-time isearch-lazy-highlight-interval nil
- 'isearch-lazy-highlight-update))
+ (start-itimer "Lazy highlight"
+ 'isearch-lazy-highlight-update
+ isearch-lazy-highlight-interval
+ nil t))
(if isearch-forward
(setq isearch-lazy-highlight-end (point-min))
(setq isearch-lazy-highlight-start (point-max))))))))))