emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs/lisp ChangeLog isearch.el


From: Juri Linkov
Subject: [Emacs-diffs] emacs/lisp ChangeLog isearch.el
Date: Mon, 07 Dec 2009 17:30:13 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Juri Linkov <jurta>     09/12/07 17:30:06

Modified files:
        lisp           : ChangeLog isearch.el 

Log message:
        Correctly restore original Isearch point.  (Bug#4994)
        
        * isearch.el (isearch-mode): Move `isearch-push-state' after
        `(run-hooks 'isearch-mode-hook)'.
        (isearch-cancel): When `isearch-push-state-function' is defined,
        let-bind `isearch-cmds' to the first state (the last element of
        `isearch-cmds') and call `isearch-top-state' (it calls pop-state
        function and restores the original point).  Otherwise, move point
        to `isearch-opoint'.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/ChangeLog?cvsroot=emacs&r1=1.16858&r2=1.16859
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/isearch.el?cvsroot=emacs&r1=1.350&r2=1.351

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.16858
retrieving revision 1.16859
diff -u -b -r1.16858 -r1.16859
--- ChangeLog   7 Dec 2009 16:18:42 -0000       1.16858
+++ ChangeLog   7 Dec 2009 17:30:01 -0000       1.16859
@@ -1,3 +1,15 @@
+2009-12-07  Juri Linkov  <address@hidden>
+
+       Correctly restore original Isearch point.  (Bug#4994)
+
+       * isearch.el (isearch-mode): Move `isearch-push-state' after
+       `(run-hooks 'isearch-mode-hook)'.
+       (isearch-cancel): When `isearch-push-state-function' is defined,
+       let-bind `isearch-cmds' to the first state (the last element of
+       `isearch-cmds') and call `isearch-top-state' (it calls pop-state
+       function and restores the original point).  Otherwise, move point
+       to `isearch-opoint'.
+
 2009-12-07  Stefan Monnier  <address@hidden>
 
        * international/mule-cmds.el (ucs-names): Weed out at compile-time the

Index: isearch.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/isearch.el,v
retrieving revision 1.350
retrieving revision 1.351
diff -u -b -r1.350 -r1.351
--- isearch.el  6 Nov 2009 05:16:28 -0000       1.350
+++ isearch.el  7 Dec 2009 17:30:05 -0000       1.351
@@ -798,10 +798,14 @@
   (setq        isearch-mode " Isearch")  ;; forward? regexp?
   (force-mode-line-update)
 
-  (isearch-push-state)
-
   (setq overriding-terminal-local-map isearch-mode-map)
   (run-hooks 'isearch-mode-hook)
+
+  ;; Pushing the initial state used to be before running isearch-mode-hook,
+  ;; but a hook might set `isearch-push-state-function' used in
+  ;; `isearch-push-state' to save mode-specific initial state.  (Bug#4994)
+  (isearch-push-state)
+
   (isearch-update)
 
   (add-hook 'mouse-leave-buffer-hook 'isearch-done)
@@ -1212,10 +1216,12 @@
 (defun isearch-cancel ()
   "Terminate the search and go back to the starting point."
   (interactive)
-  (if (functionp (isearch-pop-fun-state (car (last isearch-cmds))))
-      (funcall (isearch-pop-fun-state (car (last isearch-cmds)))
-               (car (last isearch-cmds))))
-  (goto-char isearch-opoint)
+  (if (and isearch-push-state-function isearch-cmds)
+      ;; For defined push-state function, restore the first state.
+      ;; This calls pop-state function and restores original point.
+      (let ((isearch-cmds (last isearch-cmds)))
+       (isearch-top-state))
+    (goto-char isearch-opoint))
   (isearch-done t)                      ; exit isearch
   (isearch-clean-overlays)
   (signal 'quit nil))                   ; and pass on quit signal




reply via email to

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