emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/lisp/vc.el,v


From: Dan Nicolaescu
Subject: [Emacs-diffs] Changes to emacs/lisp/vc.el,v
Date: Sun, 23 Mar 2008 18:12:20 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Changes by:     Dan Nicolaescu <dann>   08/03/23 18:12:19

Index: vc.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/vc.el,v
retrieving revision 1.554
retrieving revision 1.555
diff -u -b -r1.554 -r1.555
--- vc.el       22 Mar 2008 20:32:10 -0000      1.554
+++ vc.el       23 Mar 2008 18:12:17 -0000      1.555
@@ -2688,35 +2688,44 @@
 (defun vc-status-prepare-status-buffer (dir &optional create-new)
   "Find a *vc-status* buffer showing DIR, or create a new one."
   (setq dir (expand-file-name dir))
-  (let ((bname "*vc-status*"))
+  (let* ((bname "*vc-status*")
     ;; Look for another *vc-status* buffer visiting the same directory.
-    (save-excursion
+        (buf (save-excursion
       (unless create-new
        (dolist (buffer (buffer-list))
          (set-buffer buffer)
          (when (and (eq major-mode 'vc-status-mode)
-                    (string= default-directory dir))
-           (return buffer)))))
+                              (string= (expand-file-name default-directory) 
dir))
+                     (return buffer)))))))
+    (if buf
+       buf
     ;; Create a new *vc-status* buffer.
     (with-current-buffer (create-file-buffer bname)
       (cd dir)
       (vc-setup-buffer (current-buffer))
-      (current-buffer))))
+       (current-buffer)))))
 
 ;;;###autoload
 (defun vc-status (dir)
   "Show the VC status for DIR."
   (interactive "DVC status for directory: ")
   (switch-to-buffer (vc-status-prepare-status-buffer dir))
-  (vc-status-mode))
+  (if (eq major-mode 'vc-status-mode)
+      (vc-status-refresh)
+    (vc-status-mode)))
 
 (defvar vc-status-menu-map
   (let ((map (make-sparse-keymap "VC-status")))
     (define-key map [quit] 
       '(menu-item "Quit" bury-buffer
                  :help "Quit"))
+    (define-key map [kill]
+      '(menu-item "Kill Update Command" vc-status-kill-dir-status-process
+                 :enable vc-status-process-buffer
+                 :help "Kill the command that updates VC status buffer"))
     (define-key map [refresh] 
       '(menu-item "Refresh" vc-status-refresh
+                 :enable (not vc-status-process-buffer)
                  :help "Refresh the contents of the VC status buffer"))
     (define-key map [remup] 
       '(menu-item "Remove up-to-date" vc-status-remove-up-to-date
@@ -2825,8 +2834,6 @@
   nil)
 
 (defun vc-status-menu-map-filter (orig-binding)
-  (if (boundp 'vc-ignore-menu-filter)
-      orig-binding
     (when (and (symbolp orig-binding) (fboundp orig-binding))
       (setq orig-binding (indirect-function orig-binding)))
     (let ((ext-binding
@@ -2836,7 +2843,7 @@
          orig-binding
        (append orig-binding
                '("----")
-               ext-binding)))))
+             ext-binding))))
 
 (defun vc-status-menu (e)
   "Popup the VC status menu."
@@ -2844,9 +2851,7 @@
   (popup-menu vc-status-menu-map e))
 
 (defvar vc-status-tool-bar-map
-  (if (display-graphic-p)
-      (let ((map (make-sparse-keymap))
-           (vc-ignore-menu-filter t)) ;; Backend may not support vc-status
+  (let ((map (make-sparse-keymap)))
        (tool-bar-local-item-from-menu 'vc-status-find-file "open" 
                                       map vc-status-mode-map)
        (tool-bar-local-item "bookmark_add" 
@@ -2862,10 +2867,11 @@
                                       map vc-status-mode-map)
        (tool-bar-local-item-from-menu 'nonincremental-search-forward
                                       "search" map)
+    (tool-bar-local-item-from-menu 'vc-status-kill-dir-status-process "cancel"
+                                  map vc-status-mode-map)
        (tool-bar-local-item-from-menu 'bury-buffer "exit" 
                                       map vc-status-mode-map)
-       map)))
-
+    map))
                
 (defvar vc-status-process-buffer nil
   "The buffer used for the asynchronous call that computes the VC status.")
@@ -2911,7 +2917,8 @@
             (setf (vc-status-fileinfo->marked arg) t)))
         vc-status))
       (ewoc-goto-node vc-status (ewoc-nth vc-status 0)))
-    ;; We are done, turn of the in progress message in the mode-line.
+    (setq vc-status-process-buffer nil)
+    ;; We are done, turn off the mode-line "in progress" message.
     (setq mode-line-process nil)))
 
 (defun vc-status-add-entry (entry buffer)
@@ -2938,9 +2945,11 @@
         vc-status (vc-status-create-fileinfo (cdr entry) (car entry)))))))
 
 (defun vc-status-refresh ()
-  "Refresh the contents of the VC status buffer."
+  "Refresh the contents of the VC status buffer.
+Throw an error if another update process is in progress."
   (interactive)
-
+  (if vc-status-process-buffer
+      (error "Another update process is in progress, cannot run two at a time")
   ;; This is not very efficient; ewoc could use a new function here.
   ;; We clear the ewoc, but remember the marked files so that we can
   ;; mark them after the refresh is done.
@@ -2962,7 +2971,7 @@
     (setq vc-status-process-buffer
          (vc-call-backend
           backend 'dir-status default-directory
-          #'vc-update-vc-status-buffer (current-buffer)))))
+            #'vc-update-vc-status-buffer (current-buffer))))))
 
 (defun vc-status-kill-dir-status-process ()
   "Kill the temporary buffer and associated process."
@@ -2971,6 +2980,7 @@
             (buffer-live-p vc-status-process-buffer))
     (let ((proc (get-buffer-process vc-status-process-buffer)))
       (when proc (delete-process proc))
+      (setq vc-status-process-buffer nil)
       (setq mode-line-process nil))))
 
 (defun vc-status-next-line (arg)




reply via email to

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