changeset 59442:37d47d9bf8b1

(vc-allow-async-revert): New user option. (vc-disable-async-diff): New internal variable. (vc-revert-buffer): Use them to disable asynchronous diff.
author André Spiegel <spiegel@gnu.org>
date Sun, 09 Jan 2005 21:27:28 +0000
parents 85a7102acb30
children fd6e4e55ca84
files lisp/vc.el
diffstat 1 files changed, 19 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/vc.el	Sun Jan 09 18:03:01 2005 +0000
+++ b/lisp/vc.el	Sun Jan 09 21:27:28 2005 +0000
@@ -152,7 +152,7 @@
 ;;   have such a brief-comparison feature, the default implementation of
 ;;   this function can be used, which delegates to a full
 ;;   vc-BACKEND-diff.  (Note that vc-BACKEND-diff must not run
-;;   asynchronously in this case.)
+;;   asynchronously in this case, see variable `vc-disable-async-diff'.)
 ;;
 ;; - mode-line-string (file)
 ;;
@@ -566,6 +566,15 @@
   :group 'vc
   :version "21.1")
 
+(defcustom vc-allow-async-revert nil
+  "*Specifies whether the diff during \\[vc-revert-buffer] may be asynchronous.
+Enabling this option means that you can confirm a revert operation even
+if the local changes in the file have not been found and displayed yet."
+  :type '(choice (const :tag "No" nil)
+                 (const :tag "Yes" t))
+  :group 'vc
+  :version "21.4")
+
 ;;;###autoload
 (defcustom vc-checkout-hook nil
   "*Normal hook (list of functions) run after checking out a file.
@@ -714,6 +723,11 @@
 (defvar vc-parent-buffer-name nil)
 (put 'vc-parent-buffer-name 'permanent-local t)
 
+(defvar vc-disable-async-diff nil
+  "VC sets this to t locally to disable some async diff operations.
+Backends that offer asynchronous diffs should respect this variable
+in their implementation of vc-BACKEND-diff.")
+
 (defvar vc-log-file)
 (defvar vc-log-version)
 
@@ -2435,11 +2449,13 @@
         (unless (yes-or-no-p "File seems up-to-date.  Revert anyway? ")
           (error "Revert canceled")))
     (unless (vc-workfile-unchanged-p file)
+      (message "Finding changes...")
       ;; vc-diff selects the new window, which is not what we want:
       ;; if the new window is on another frame, that'd require the user
       ;; moving her mouse to answer the yes-or-no-p question.
-      (let ((win (save-selected-window
-		   (setq status (vc-diff nil t)) (selected-window))))
+      (let* ((vc-disable-async-diff (not vc-allow-async-revert))
+             (win (save-selected-window
+                    (setq status (vc-diff nil t)) (selected-window))))
 	(vc-exec-after `(message nil))
 	(when status
 	  (unwind-protect