bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#1256: Race condition in vc-diff


From: Bob Rogers
Subject: bug#1256: Race condition in vc-diff
Date: Sat, 25 Oct 2008 18:33:01 -0400

   This problem seems to affect only the trunk, and not 22.3.  (I last
built emacs on 21-Oct.)

   To reproduce this, you need a working copy with a VCS that has a fast
backend "diff to base" command; something that doesn't have to contact a
server is probably a requirement (I used SVN with the WC on a local
disk).  You also need a version-controlled file with a trivial change
with respect to the base version; touching a single line is sufficient.

   If you visit this file and do "C-x v =" in a single-window frame that
is more than about 30 lines tall, and if the backend diff command is
fast enough, the diff window will remain half the size of the screen,
rather than being shrunk to fit the buffer.  This is because
vc-exec-after finds that the buffer process has already finished, and
runs vc-diff-finish before the diff buffer has been made visible.  In
that case, vc-diff-finish assumes that the user has already buried it.

   I am not a big fan of this shrink-wrapping, but I do think vc-diff
ought to behave consistently (and it has worked this way for quite a
while now).  The attached patch is sufficient to fix it.

                                        -- Bob Rogers
                                           http://rgrjr.dyndns.org/

--- lisp/vc.el.~1.706.~ 2008-10-06 21:02:25.000000000 -0400
+++ lisp/vc.el  2008-10-25 17:49:35.000000000 -0400
@@ -1507,10 +1507,12 @@
       ;; bindings are nicer for read only buffers. pcl-cvs does the
       ;; same thing.
       (setq buffer-read-only t)
-      (vc-exec-after `(vc-diff-finish ,(current-buffer) ',(when verbose
-                                                            messages)))
       ;; Display the buffer, but at the end because it can change point.
       (pop-to-buffer (current-buffer))
+      ;; Do this after pop-to-buffer, because it needs to see the proper window
+      ;; state if it runs immediately.  -- rgr, 25-Oct-08.
+      (vc-exec-after `(vc-diff-finish ,(current-buffer) ',(when verbose
+                                                            messages)))
       ;; In the async case, we return t even if there are no differences
       ;; because we don't know that yet.
       t)))

reply via email to

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