]> code.delx.au - gnu-emacs/blobdiff - lisp/isearch.el
(isearch-done): Move point (for small window)
[gnu-emacs] / lisp / isearch.el
index ee46727d5aa02bc2ffa0b162ddbb3f9af7c970dd..77ce1aeb6b37444a9b65cc5ff5d41ad50094bc86 100644 (file)
@@ -4,7 +4,7 @@
 
 ;; 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.
@@ -83,7 +83,7 @@
 ;; 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.
 
@@ -584,21 +584,21 @@ is treated as a regexp.  See \\[isearch-forward] for more info."
     (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
@@ -626,7 +626,7 @@ is treated as a regexp.  See \\[isearch-forward] for more info."
 
 ;;;=======================================================
 ;;; 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.
@@ -664,7 +664,7 @@ The following additional command keys are active while editing.
 \\[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."
@@ -673,10 +673,10 @@ 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.
@@ -804,7 +804,7 @@ If first char entered is \\[isearch-yank-word], then do word search instead."
 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
@@ -1008,13 +1008,21 @@ and the meta character is unread so that it applies to editing the string."
         (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))
@@ -1024,7 +1032,6 @@ and the meta character is unread so that it applies to editing the string."
         (isearch-process-search-string (this-command-keys)
                                        (this-command-keys)))))
 
-
 (defun isearch-quote-char ()
   "Quote special characters for incremental search."
   (interactive)
@@ -1050,7 +1057,7 @@ If you want to search for just a space, type C-q SPC."
          (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)
@@ -1332,11 +1339,13 @@ If there is no completion possible, say so and continue searching."
 (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