Mercurial > emacs
changeset 93148:4422d1ec58d7
(vc-status-prepare-status-buffer): New function.
(vc-status): Use it.
author | Dan Nicolaescu <dann@ics.uci.edu> |
---|---|
date | Sat, 22 Mar 2008 20:32:10 +0000 |
parents | 641cbad340a8 |
children | 5ec26b66bbe8 |
files | lisp/ChangeLog lisp/vc.el |
diffstat | 2 files changed, 22 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/ChangeLog Sat Mar 22 17:51:17 2008 +0000 +++ b/lisp/ChangeLog Sat Mar 22 20:32:10 2008 +0000 @@ -1,5 +1,8 @@ 2008-03-22 Dan Nicolaescu <dann@ics.uci.edu> + * vc.el (vc-status-prepare-status-buffer): New function. + (vc-status): Use it. + * emacs-lisp/lisp-mode.el (emacs-lisp-mode-map): Add ... where appropriate.
--- a/lisp/vc.el Sat Mar 22 17:51:17 2008 +0000 +++ b/lisp/vc.el Sat Mar 22 20:32:10 2008 +0000 @@ -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