:type 'boolean
:group 'isearch)
-(defcustom isearch-resume-enabled t
- "*If non-nil, `isearch-resume' commands are added to the command history."
+(defcustom isearch-resume-in-command-history nil
+ "*If non-nil, `isearch-resume' commands are added to the command history.
+This allows you to resume earlier isearch sessions through the
+command history."
:type 'boolean
:group 'isearch)
(setq disable-point-adjustment t))
(defun isearch-done (&optional nopush edit)
- (if isearch-resume-enabled
+ (if isearch-resume-in-command-history
(let ((command `(isearch-resume ,isearch-string ,isearch-regexp
,isearch-word ,isearch-forward
,isearch-message
(if isearch-small-window
(goto-char found-point)
;; Exiting the save-window-excursion clobbers window-start; restore it.
- (set-window-start (selected-window) found-start t))
-
- ;; If there was movement, mark the starting position.
- ;; Maybe should test difference between and set mark iff > threshold.
- (if (/= (point) isearch-opoint)
- (or (and transient-mark-mode mark-active)
- (progn
- (push-mark isearch-opoint t)
- (or executing-kbd-macro (> (minibuffer-depth) 0)
- (message "Mark saved where search started"))))))
+ (set-window-start (selected-window) found-start t)))
(setq isearch-mode nil)
(if isearch-input-method-local-p
(isearch-update-ring isearch-string isearch-regexp))
(run-hooks 'isearch-mode-end-hook)
+
+ ;; If there was movement, mark the starting position.
+ ;; Maybe should test difference between and set mark iff > threshold.
+ (if (/= (point) isearch-opoint)
+ (or (and transient-mark-mode mark-active)
+ (progn
+ (push-mark isearch-opoint t)
+ (or executing-kbd-macro (> (minibuffer-depth) 0)
+ (message "Mark saved where search started")))))
+
(and (not edit) isearch-recursive-edit (exit-recursive-edit)))
(defun isearch-update-ring (string &optional regexp)
(defun isearch-yank-line ()
"Pull rest of line from buffer into search string."
(interactive)
- (isearch-yank-internal 'line-end-position))
-
+ (isearch-yank-internal
+ (lambda () (line-end-position (if (eolp) 2 1)))))
(defun isearch-search-and-update ()
;; Do the search and update the display.
(let ((mb (match-beginning 0))
(me (match-end 0)))
(if (= mb me) ;zero-length match
- (forward-char 1)
+ (if isearch-forward
+ (if (= mb (if isearch-lazy-highlight-wrapped
+ isearch-lazy-highlight-start
+ (window-end)))
+ (setq found nil)
+ (forward-char 1))
+ (if (= mb (if isearch-lazy-highlight-wrapped
+ isearch-lazy-highlight-end
+ (window-start)))
+ (setq found nil)
+ (forward-char -1)))
;; non-zero-length match
(let ((ov (make-overlay mb me)))
(push ov isearch-lazy-highlight-overlays)))
(if isearch-forward
(setq isearch-lazy-highlight-end (point))
- (setq isearch-lazy-highlight-start (point))))
-
- ;; not found
- (if isearch-lazy-highlight-wrapped
- (setq looping nil
- nomore t)
- (setq isearch-lazy-highlight-wrapped t)
- (if isearch-forward
- (progn
- (setq isearch-lazy-highlight-end (window-start))
- (goto-char (window-start)))
- (setq isearch-lazy-highlight-start (window-end))
- (goto-char (window-end)))))))
+ (setq isearch-lazy-highlight-start (point)))))
+
+ ;; not found or zero-length match at the search bound
+ (if (not found)
+ (if isearch-lazy-highlight-wrapped
+ (setq looping nil
+ nomore t)
+ (setq isearch-lazy-highlight-wrapped t)
+ (if isearch-forward
+ (progn
+ (setq isearch-lazy-highlight-end (window-start))
+ (goto-char (window-start)))
+ (setq isearch-lazy-highlight-start (window-end))
+ (goto-char (window-end)))))))
(unless nomore
(setq isearch-lazy-highlight-timer
(run-at-time isearch-lazy-highlight-interval nil