;; Author: Daniel LaLiberte <liberte@cs.uiuc.edu>
-;; |$Date: 1993/06/04 06:40:45 $|$Revision: 1.40 $
+;; |$Date: 1993/07/15 03:46:02 $|$Revision: 1.46 $
;; This file is not yet part of GNU Emacs, but it is based almost
;; entirely on isearch.el which is part of GNU Emacs.
;; the last possible moment.
;; TODO
-;; - Integrate the emacs 19 generalized commmand history.
+;; - Integrate the emacs 19 generalized command history.
;; - Think about incorporating query-replace.
;; - Hooks and options for failed search.
(if isearch-window-configuration
(set-window-configuration isearch-window-configuration))
+ (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)
(progn
(push-mark isearch-opoint t)
- (if transient-mark-mode
- (setq mark-active nil))
+ (deactivate-mark)
(or executing-macro (> (minibuffer-depth) 0)
(message "Mark saved where search started")))
;; (message "") why is this needed?
)
- (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)))
(setq isearch-mode nil)
(set-buffer-modified-p (buffer-modified-p)) ;; update modeline
;;;=======================================================
;;; Switching buffers should first terminate isearch-mode.
-;;; This is done quite differently for each varient of emacs.
+;;; This is done quite differently for each variant of emacs.
;;; For lemacs, see Exiting in lemacs below
;; For Emacs 19, the frame switch event is handled.
\\[isearch-forward-exit-minibuffer] to resume isearching forward.
\\[isearch-backward-exit-minibuffer] to resume isearching backward.
\\[isearch-ring-advance-edit] to replace the search string with the next item in the search ring.
-\\[isearch-ring-retreat-edit] to replace the search string with the previou item in the search ring.
+\\[isearch-ring-retreat-edit] to replace the search string with the previous item in the search ring.
\\[isearch-complete-edit] to complete the search string using the search ring.
If first char entered is \\[isearch-yank-word], then do word search instead."
;; Mainly, isearch-mode must be terminated while editing and then restarted.
;; If there were a way to catch any change of buffer from the minibuffer,
;; this could be simplified greatly.
- ;; Editing doesnt back up the search point. Should it?
+ ;; Editing doesn't back up the search point. Should it?
(interactive)
(condition-case err
- (let (isearch-nonincremental ; should search nonincrementally?
+ (let ((isearch-nonincremental isearch-nonincremental)
;; Locally bind all isearch global variables to protect them
;; from recursive isearching.
Otherwise, revert to previous successful search and continue searching.
Use `isearch-exit' to quit without signalling."
(interactive)
-;; (ding) signal instead below, if quiting
+;; (ding) signal instead below, if quitting
(discard-input)
(if isearch-success
;; If search is successful, move back to starting point
(isearch-edit-string))
(search-exit-option
(let ((key (this-command-keys))
+ (index 0)
window)
(apply 'isearch-unread (listify-key-sequence key))
+ ;; Properly handle scroll-bar and mode-line clicks
+ ;; for which a dummy prefix event was generated as (aref key 0).
+ (and (> (length key) 1)
+ (symbolp (aref key 0))
+ (listp (aref key 1))
+ (consp (posn-point (event-start (aref key 1))))
+ (setq index 1))
;; If we got a mouse click, maybe it was read with the buffer
;; it was clicked on. If so, that buffer, not the current one,
;; is in isearch mode. So end the search in that buffer.
- (if (and (listp (aref key 0))
- (setq window (posn-window (event-start (aref key 0))))
+ (if (and (listp (aref key index))
+ (setq window (posn-window (event-start (aref key index))))
(windowp window))
(save-excursion
(set-buffer (window-buffer window))
(isearch-process-search-string (this-command-keys)
(this-command-keys)))))
-
(defun isearch-quote-char ()
"Quote special characters for incremental search."
(interactive)
(isearch-process-search-string search-whitespace-regexp " ")
(isearch-printing-char))
(progn
- ;; This way of doing word search doesnt correctly extend current search.
+ ;; This way of doing word search doesn't correctly extend current search.
;; (setq isearch-word t)
;; (setq isearch-adjusted t)
;; (goto-char isearch-barrier)
(defvar isearch-overlay nil)
(defun isearch-highlight (beg end)
- (if (or (null search-highlight) (not (internal-find-face 'isearch nil)))
+ (if (null search-highlight)
nil
(or isearch-overlay (setq isearch-overlay (make-overlay beg end)))
(move-overlay isearch-overlay beg end (current-buffer))
- (overlay-put isearch-overlay 'face 'isearch)))
+ (overlay-put isearch-overlay 'face
+ (if (internal-find-face 'isearch nil)
+ 'isearch 'region))))
(defun isearch-dehighlight (totally)
(if isearch-overlay