diff lisp/vc.el @ 82306:42ad26e14a99

(vc-annotate): Select temp-buffer before running vc-exec-after. Select the buffer's window before moving point.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Tue, 07 Aug 2007 03:32:24 +0000
parents 1414862f1a0d
children e5a68f18fcb9
line wrap: on
line diff
--- a/lisp/vc.el	Tue Aug 07 03:10:23 2007 +0000
+++ b/lisp/vc.el	Tue Aug 07 03:32:24 2007 +0000
@@ -3272,12 +3272,19 @@
         (set (make-local-variable 'vc-annotate-parent-display-mode)
              display-mode)))
 
-    (vc-exec-after
-     `(progn
-        (when ,current-line
-          (goto-line ,current-line ,temp-buffer-name))
-        (unless (active-minibuffer-window)
-          (message "Annotating... done"))))))
+    (with-current-buffer temp-buffer-name
+      (vc-exec-after
+       `(progn
+          ;; Ideally, we'd rather not move point if the user has already
+          ;; moved it elsewhere, but really point here is not the position
+          ;; of the user's cursor :-(
+          (when ,current-line           ;(and (bobp))
+            (let ((win (get-buffer-window (current-buffer) 0)))
+              (when win
+                (with-selected-window win
+                  (goto-line ,current-line)))))
+          (unless (active-minibuffer-window)
+            (message "Annotating... done")))))))
 
 (defun vc-annotate-prev-version (prefix)
   "Visit the annotation of the version previous to this one.