emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/isearch.el,v


From: Juri Linkov
Subject: [Emacs-diffs] Changes to emacs/lisp/isearch.el,v
Date: Sun, 22 Jul 2007 22:33:08 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Juri Linkov <jurta>     07/07/22 22:33:08

Index: isearch.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/isearch.el,v
retrieving revision 1.298
retrieving revision 1.299
diff -u -b -r1.298 -r1.299
--- isearch.el  9 Jul 2007 14:45:01 -0000       1.298
+++ isearch.el  22 Jul 2007 22:33:08 -0000      1.299
@@ -992,7 +992,7 @@
               isearch-original-minibuffer-message-timeout)
              (isearch-original-minibuffer-message-timeout
               isearch-original-minibuffer-message-timeout)
-             )
+             old-point old-other-end)
 
          ;; Actually terminate isearching until editing is done.
          ;; This is so that the user can do anything without failure,
@@ -1001,6 +1001,10 @@
              (isearch-done t t)
            (exit nil))                 ; was recursive editing
 
+         ;; Save old point and isearch-other-end before reading from minibuffer
+         ;; that can change their values.
+         (setq old-point (point) old-other-end isearch-other-end)
+
          (isearch-message) ;; for read-char
          (unwind-protect
              (let* (;; Why does following read-char echo?
@@ -1036,6 +1040,14 @@
                      isearch-new-message
                      (mapconcat 'isearch-text-char-description
                                 isearch-new-string "")))
+
+           ;; Set point at the start (end) of old match if forward (backward),
+           ;; so after exiting minibuffer isearch resumes at the start (end)
+           ;; of this match and can find it again.
+           (if (and old-other-end (eq old-point (point))
+                    (eq isearch-forward isearch-new-forward))
+               (goto-char old-other-end))
+
            ;; Always resume isearching by restarting it.
            (isearch-mode isearch-forward
                          isearch-regexp
@@ -1260,10 +1272,13 @@
       (ding)
     (setq isearch-string (substring isearch-string 0 (- (or arg 1)))
           isearch-message (mapconcat 'isearch-text-char-description
-                                     isearch-string "")
-          ;; Don't move cursor in reverse search.
-          isearch-yank-flag t))
-  (isearch-search-and-update))
+                                     isearch-string "")))
+  ;; Use the isearch-other-end as new starting point to be able
+  ;; to find the remaining part of the search string again.
+  (if isearch-other-end (goto-char isearch-other-end))
+  (isearch-search)
+  (isearch-push-state)
+  (isearch-update))
 
 (defun isearch-yank-string (string)
   "Pull STRING into search string."




reply via email to

[Prev in Thread] Current Thread [Next in Thread]