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: Sat, 22 Mar 2008 20:32:13 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Changes by:     Dan Nicolaescu <dann>   08/03/22 20:32:12

Index: vc.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/vc.el,v
retrieving revision 1.553
retrieving revision 1.554
diff -u -b -r1.553 -r1.554
--- vc.el       21 Mar 2008 17:53:03 -0000      1.553
+++ vc.el       22 Mar 2008 20:32:10 -0000      1.554
@@ -2685,13 +2685,29 @@
   ;; Must be in sync with vc-status-printer.
   (forward-char 25))
 
+(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*"))
+    ;; Look for another *vc-status* buffer visiting the same directory.
+    (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)))))
+    ;; Create a new *vc-status* buffer.
+    (with-current-buffer (create-file-buffer bname)
+      (cd dir)
+      (vc-setup-buffer (current-buffer))
+      (current-buffer))))
+
 ;;;###autoload
 (defun vc-status (dir)
   "Show the VC status for DIR."
   (interactive "DVC status for directory: ")
-  (vc-setup-buffer "*vc-status*")
-  (switch-to-buffer "*vc-status*")
-  (cd dir)
+  (switch-to-buffer (vc-status-prepare-status-buffer dir))
   (vc-status-mode))
 
 (defvar vc-status-menu-map




reply via email to

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