Subject: bug#5310: Patch Attached

From: Nathaniel Flath <[email-masked]>
Date: Fri, 29 Jan 2010 22:14:02 -0500

My apologies - looking at this in the bug tracker does not appear to show
the patch.  I must have forgotten to attach it, somehow.  The patch is as
follows:

--- vc.el    7 Dec 2009 09:02:16 -0000    1.746
+++ vc.el    4 Jan 2010 04:10:54 -0000
@@ -1975,37 +1975,38 @@
 This asks for confirmation if the buffer contents are not identical
 to the working revision (except for keyword expansion)."
   (interactive)
-  (let* ((vc-fileset (vc-deduce-fileset))
-     (files (cadr vc-fileset)))
-    ;; If any of the files is visited by the current buffer, make
-    ;; sure buffer is saved.  If the user says `no', abort since
-    ;; we cannot show the changes and ask for confirmation to
-    ;; discard them.
-    (when (or (not files) (memq (buffer-file-name) files))
-      (vc-buffer-sync nil))
-    (dolist (file files)
-      (let ((buf (get-file-buffer file)))
-    (when (and buf (buffer-modified-p buf))
-      (error "Please kill or save all modified buffers before reverting")))
-      (when (vc-up-to-date-p file)
-    (unless (yes-or-no-p (format "%s seems up-to-date.  Revert anyway? "
file))
-      (error "Revert canceled"))))
-    (when (vc-diff-internal vc-allow-async-revert vc-fileset nil nil)
-      (unless (yes-or-no-p
-           (format "Discard changes in %s? "
-               (let ((str (vc-delistify files))
-                 (nfiles (length files)))
-             (if (< (length str) 50)
-                 str
-               (format "%d file%s" nfiles
-                   (if (= nfiles 1) "" "s"))))))
-    (error "Revert canceled"))
-      (delete-windows-on "*vc-diff*")
-      (kill-buffer "*vc-diff*"))
-    (dolist (file files)
-      (message "Reverting %s..." (vc-delistify files))
-      (vc-revert-file file)
-      (message "Reverting %s...done" (vc-delistify files)))))
+  (save-window-excursion
+   (let* ((vc-fileset (vc-deduce-fileset))
+          (files (cadr vc-fileset)))
+     ;; If any of the files is visited by the current buffer, make
+     ;; sure buffer is saved.  If the user says `no', abort since
+     ;; we cannot show the changes and ask for confirmation to
+     ;; discard them.
+     (when (or (not files) (memq (buffer-file-name) files))
+       (vc-buffer-sync nil))
+     (dolist (file files)
+       (let ((buf (get-file-buffer file)))
+         (when (and buf (buffer-modified-p buf))
+           (error "Please kill or save all modified buffers before
reverting")))
+       (when (vc-up-to-date-p file)
+         (unless (yes-or-no-p (format "%s seems up-to-date.  Revert anyway?
" file))
+           (error "Revert canceled"))))
+     (when (vc-diff-internal vc-allow-async-revert vc-fileset nil nil)
+       (unless (yes-or-no-p
+                (format "Discard changes in %s? "
+                        (let ((str (vc-delistify files))
+                              (nfiles (length files)))
+                          (if (< (length str) 50)
+                              str
+                            (format "%d file%s" nfiles
+                                    (if (= nfiles 1) "" "s"))))))
+         (error "Revert canceled"))
+       (delete-windows-on "*vc-diff*")
+       (kill-buffer "*vc-diff*"))
+     (dolist (file files)
+       (message "Reverting %s..." (vc-delistify files))
+       (vc-revert-file file)
+       (message "Reverting %s...done" (vc-delistify files))))))

 ;;;###autoload
 (defun vc-rollback ()