aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric S. Raymond2008-05-03 10:47:28 +0000
committerEric S. Raymond2008-05-03 10:47:28 +0000
commit4f61cc3e1ff209fe3c6a184d2fdc0d1f5fe39eb6 (patch)
treeb7e3f7ecf9a2b6d8d4c49ef816beb820624c6907
parenta43e305413e3cce45496bcbfa6845b7fd6c206cc (diff)
downloademacs-4f61cc3e1ff209fe3c6a184d2fdc0d1f5fe39eb6.tar.gz
emacs-4f61cc3e1ff209fe3c6a184d2fdc0d1f5fe39eb6.zip
Move VC-Dired code from vc.el to vc-dispatcher.el.
-rw-r--r--lisp/vc-dispatcher.el234
-rw-r--r--lisp/vc.el229
2 files changed, 235 insertions, 228 deletions
diff --git a/lisp/vc-dispatcher.el b/lisp/vc-dispatcher.el
index 0fc1c0636d5..ef4cffd2f8d 100644
--- a/lisp/vc-dispatcher.el
+++ b/lisp/vc-dispatcher.el
@@ -76,12 +76,17 @@
76 76
77(provide 'vc-dispatcher) 77(provide 'vc-dispatcher)
78 78
79(eval-when-compile
80 (require 'cl)
81 (require 'dired) ; for dired-map-over-marks macro
82 (require 'dired-aux)) ; for dired-kill-{line,tree}
83
79;; General customization 84;; General customization
80 85
81(defcustom vc-logentry-check-hook nil 86(defcustom vc-logentry-check-hook nil
82 "Normal hook run by `vc-finish-logentry'. 87 "Normal hook run by `vc-finish-logentry'.
83Use this to impose your own rules on the entry in addition to any the 88Use this to impose your own rules on the entry in addition to any the
84version control backend imposes itself." 89dispatcher client mode imposes itself."
85 :type 'hook 90 :type 'hook
86 :group 'vc) 91 :group 'vc)
87 92
@@ -590,11 +595,236 @@ the buffer contents as a comment."
590 (mapc 595 (mapc
591 (lambda (file) (vc-resynch-buffer file vc-keep-workfiles t)) 596 (lambda (file) (vc-resynch-buffer file vc-keep-workfiles t))
592 log-fileset)) 597 log-fileset))
593 ;; FIXME: Call into vc.el
594 (when vc-dired-mode 598 (when vc-dired-mode
595 (dired-move-to-filename)) 599 (dired-move-to-filename))
596 (when (eq major-mode 'vc-dir-mode) 600 (when (eq major-mode 'vc-dir-mode)
597 (vc-dir-move-to-goal-column)) 601 (vc-dir-move-to-goal-column))
598 (run-hooks after-hook 'vc-finish-logentry-hook))) 602 (run-hooks after-hook 'vc-finish-logentry-hook)))
599 603
604;; VC-Dired mode (to be removed when vc-dir support is finished)
605
606(defcustom vc-dired-listing-switches "-al"
607 "Switches passed to `ls' for vc-dired. MUST contain the `l' option."
608 :type 'string
609 :group 'vc
610 :version "21.1")
611
612(defcustom vc-dired-recurse t
613 "If non-nil, show directory trees recursively in VC Dired."
614 :type 'boolean
615 :group 'vc
616 :version "20.3")
617
618(defcustom vc-dired-terse-display t
619 "If non-nil, show only locked or locally modified files in VC Dired."
620 :type 'boolean
621 :group 'vc
622 :version "20.3")
623
624(defvar vc-dired-mode nil)
625(defvar vc-dired-window-configuration)
626
627(make-variable-buffer-local 'vc-dired-mode)
628
629;; The VC directory major mode. Coopt Dired for this.
630;; All VC commands get mapped into logical equivalents.
631
632(defvar vc-dired-switches)
633(defvar vc-dired-terse-mode)
634
635(defvar vc-dired-mode-map
636 (let ((map (make-sparse-keymap))
637 (vmap (make-sparse-keymap)))
638 (define-key map "\C-xv" vmap)
639 (define-key map "v" vmap)
640 (set-keymap-parent vmap vc-prefix-map)
641 (define-key vmap "t" 'vc-dired-toggle-terse-mode)
642 map))
643
644(define-derived-mode vc-dired-mode dired-mode "Dired under VC"
645 "The major mode used in VC directory buffers.
646
647It works like Dired, but lists only files under version control, with
648the current VC state of each file being indicated in the place of the
649file's link count, owner, group and size. Subdirectories are also
650listed, and you may insert them into the buffer as desired, like in
651Dired.
652
653All Dired commands operate normally, with the exception of `v', which
654is redefined as the version control prefix, so that you can type
655`vl', `v=' etc. to invoke `vc-print-log', `vc-diff', and the like on
656the file named in the current Dired buffer line. `vv' invokes
657`vc-next-action' on this file, or on all files currently marked.
658There is a special command, `*l', to mark all files currently locked."
659 ;; define-derived-mode does it for us in Emacs-21, but not in Emacs-20.
660 ;; We do it here because dired might not be loaded yet
661 ;; when vc-dired-mode-map is initialized.
662 (set-keymap-parent vc-dired-mode-map dired-mode-map)
663 (add-hook 'dired-after-readin-hook 'vc-dired-hook nil t)
664 ;; The following is slightly modified from files.el,
665 ;; because file lines look a bit different in vc-dired-mode
666 ;; (the column before the date does not end in a digit).
667 ;; albinus: It should be done in the original declaration. Problem
668 ;; is the optional empty state-info; otherwise ")" would be good
669 ;; enough as delimeter.
670 (set (make-local-variable 'directory-listing-before-filename-regexp)
671 (let* ((l "\\([A-Za-z]\\|[^\0-\177]\\)")
672 ;; In some locales, month abbreviations are as short as 2 letters,
673 ;; and they can be followed by ".".
674 (month (concat l l "+\\.?"))
675 (s " ")
676 (yyyy "[0-9][0-9][0-9][0-9]")
677 (dd "[ 0-3][0-9]")
678 (HH:MM "[ 0-2][0-9]:[0-5][0-9]")
679 (seconds "[0-6][0-9]\\([.,][0-9]+\\)?")
680 (zone "[-+][0-2][0-9][0-5][0-9]")
681 (iso-mm-dd "[01][0-9]-[0-3][0-9]")
682 (iso-time (concat HH:MM "\\(:" seconds "\\( ?" zone "\\)?\\)?"))
683 (iso (concat "\\(\\(" yyyy "-\\)?" iso-mm-dd "[ T]" iso-time
684 "\\|" yyyy "-" iso-mm-dd "\\)"))
685 (western (concat "\\(" month s "+" dd "\\|" dd "\\.?" s month "\\)"
686 s "+"
687 "\\(" HH:MM "\\|" yyyy "\\)"))
688 (western-comma (concat month s "+" dd "," s "+" yyyy))
689 ;; Japanese MS-Windows ls-lisp has one-digit months, and
690 ;; omits the Kanji characters after month and day-of-month.
691 (mm "[ 0-1]?[0-9]")
692 (japanese
693 (concat mm l "?" s dd l "?" s "+"
694 "\\(" HH:MM "\\|" yyyy l "?" "\\)")))
695 ;; the .* below ensures that we find the last match on a line
696 (concat ".*" s
697 "\\(" western "\\|" western-comma "\\|" japanese "\\|" iso "\\)"
698 s "+")))
699 (and (boundp 'vc-dired-switches)
700 vc-dired-switches
701 (set (make-local-variable 'dired-actual-switches)
702 vc-dired-switches))
703 (set (make-local-variable 'vc-dired-terse-mode) vc-dired-terse-display)
704 ;;(let ((backend-name (symbol-name (vc-responsible-backend
705 ;; default-directory))))
706 ;; (setq mode-name (concat mode-name backend-name))
707 ;; ;; Add menu after `vc-dired-mode-map' has `dired-mode-map' as the parent.
708 ;; (let ((vc-dire-menu-map (copy-keymap vc-menu-map)))
709 ;; (define-key-after (lookup-key vc-dired-mode-map [menu-bar]) [vc]
710 ;; (cons backend-name vc-dire-menu-map) 'subdir)))
711 (setq vc-dired-mode t))
712
713(defun vc-dired-toggle-terse-mode ()
714 "Toggle terse display in VC Dired."
715 (interactive)
716 (if (not vc-dired-mode)
717 nil
718 (setq vc-dired-terse-mode (not vc-dired-terse-mode))
719 (if vc-dired-terse-mode
720 (vc-dired-hook)
721 (revert-buffer))))
722
723(defun vc-dired-mark-locked ()
724 "Mark all files currently locked."
725 (interactive)
726 (dired-mark-if (let ((f (dired-get-filename nil t)))
727 (and f
728 (not (file-directory-p f))
729 (not (vc-up-to-date-p f))))
730 "locked file"))
731
732(define-key vc-dired-mode-map "*l" 'vc-dired-mark-locked)
733
734(defun vc-dired-reformat-line (vc-info)
735 "Reformat a directory-listing line.
736Replace various columns with version control information, VC-INFO.
737This code, like dired, assumes UNIX -l format."
738 (beginning-of-line)
739 (when (re-search-forward
740 ;; Match link count, owner, group, size. Group may be missing,
741 ;; and only the size is present in OS/2 -l format.
742 "^..[drwxlts-]+ \\( *[0-9]+\\( [^ ]+ +\\([^ ]+ +\\)?[0-9]+\\)?\\) "
743 (line-end-position) t)
744 (replace-match (substring (concat vc-info " ") 0 10)
745 t t nil 1)))
746
747(defun vc-dired-ignorable-p (filename)
748 "Should FILENAME be ignored in VC-Dired listings?"
749 (catch t
750 ;; Ignore anything that wouldn't be found by completion (.o, .la, etc.)
751 (dolist (ignorable completion-ignored-extensions)
752 (let ((ext (substring filename
753 (- (length filename)
754 (length ignorable)))))
755 (if (string= ignorable ext) (throw t t))))
756 ;; Ignore Makefiles derived from something else
757 (when (string= (file-name-nondirectory filename) "Makefile")
758 (let* ((dir (file-name-directory filename))
759 (peers (directory-files (or dir default-directory))))
760 (if (or (member "Makefile.in" peers) (member "Makefile.am" peers))
761 (throw t t))))
762 nil))
763
764(defun vc-dired-purge ()
765 "Remove empty subdirs."
766 (goto-char (point-min))
767 (while (dired-get-subdir)
768 (forward-line 2)
769 (if (dired-get-filename nil t)
770 (if (not (dired-next-subdir 1 t))
771 (goto-char (point-max)))
772 (forward-line -2)
773 (if (not (string= (dired-current-directory) default-directory))
774 (dired-do-kill-lines t "")
775 ;; We cannot remove the top level directory.
776 ;; Just make it look a little nicer.
777 (forward-line 1)
778 (or (eobp) (kill-line))
779 (if (not (dired-next-subdir 1 t))
780 (goto-char (point-max))))))
781 (goto-char (point-min)))
782
783(defun vc-dired-buffers-for-dir (dir)
784 "Return a list of all vc-dired buffers that currently display DIR."
785 (let (result)
786 ;; Check whether dired is loaded.
787 (when (fboundp 'dired-buffers-for-dir)
788 (dolist (buffer (dired-buffers-for-dir dir))
789 (with-current-buffer buffer
790 (when vc-dired-mode
791 (push buffer result)))))
792 (nreverse result)))
793
794(defun vc-directory-resynch-file (file)
795 "Update the entries for FILE in any VC Dired buffers that list it."
796 ;;FIXME This needs to be implemented so it works for vc-dir
797 (let ((buffers (vc-dired-buffers-for-dir (file-name-directory file))))
798 (when buffers
799 (mapcar (lambda (buffer)
800 (with-current-buffer buffer
801 (when (dired-goto-file file)
802 ;; bind vc-dired-terse-mode to nil so that
803 ;; files won't vanish when they are checked in
804 (let ((vc-dired-terse-mode nil))
805 (dired-do-redisplay 1)))))
806 buffers))))
807
808;;;###autoload
809(defun vc-directory (dir read-switches)
810 "Create a buffer in VC Dired Mode for directory DIR.
811
812See Info node `VC Dired Mode'.
813
814With prefix arg READ-SWITCHES, specify a value to override
815`dired-listing-switches' when generating the listing."
816 (interactive "DDired under VC (directory): \nP")
817 (let ((vc-dired-switches (concat vc-dired-listing-switches
818 (if vc-dired-recurse "R" ""))))
819 (if read-switches
820 (setq vc-dired-switches
821 (read-string "Dired listing switches: "
822 vc-dired-switches)))
823 (require 'dired)
824 (require 'dired-aux)
825 (switch-to-buffer
826 (dired-internal-noselect (expand-file-name (file-name-as-directory dir))
827 vc-dired-switches
828 'vc-dired-mode))))
829
600;;; vc-dispatcher.el ends here 830;;; vc-dispatcher.el ends here
diff --git a/lisp/vc.el b/lisp/vc.el
index 76c7b3a2f64..ad01ed3d05e 100644
--- a/lisp/vc.el
+++ b/lisp/vc.el
@@ -694,9 +694,7 @@
694(require 'ewoc) 694(require 'ewoc)
695 695
696(eval-when-compile 696(eval-when-compile
697 (require 'cl) 697 (require 'cl))
698 (require 'dired) ; for dired-map-over-marks macro
699 (require 'dired-aux)) ; for dired-kill-{line,tree}
700 698
701(unless (assoc 'vc-parent-buffer minor-mode-alist) 699(unless (assoc 'vc-parent-buffer minor-mode-alist)
702 (setq minor-mode-alist 700 (setq minor-mode-alist
@@ -757,24 +755,6 @@ These are passed to the checkin program by \\[vc-register]."
757 string)) 755 string))
758 :group 'vc) 756 :group 'vc)
759 757
760(defcustom vc-dired-listing-switches "-al"
761 "Switches passed to `ls' for vc-dired. MUST contain the `l' option."
762 :type 'string
763 :group 'vc
764 :version "21.1")
765
766(defcustom vc-dired-recurse t
767 "If non-nil, show directory trees recursively in VC Dired."
768 :type 'boolean
769 :group 'vc
770 :version "20.3")
771
772(defcustom vc-dired-terse-display t
773 "If non-nil, show only locked or locally modified files in VC Dired."
774 :type 'boolean
775 :group 'vc
776 :version "20.3")
777
778(defcustom vc-diff-switches nil 758(defcustom vc-diff-switches nil
779 "A string or list of strings specifying switches for diff under VC. 759 "A string or list of strings specifying switches for diff under VC.
780When running diff under a given BACKEND, VC concatenates the values of 760When running diff under a given BACKEND, VC concatenates the values of
@@ -977,9 +957,6 @@ and that its contents match what the master file says."
977Backends that offer asynchronous diffs should respect this variable 957Backends that offer asynchronous diffs should respect this variable
978in their implementation of vc-BACKEND-diff.") 958in their implementation of vc-BACKEND-diff.")
979 959
980(defvar vc-dired-mode nil)
981(make-variable-buffer-local 'vc-dired-mode)
982
983;; File property caching 960;; File property caching
984 961
985(defun vc-clear-context () 962(defun vc-clear-context ()
@@ -1200,8 +1177,6 @@ NOT-URGENT means it is ok to continue if the user says not to save."
1200 (unless not-urgent 1177 (unless not-urgent
1201 (error "Aborted"))))) 1178 (error "Aborted")))))
1202 1179
1203(defvar vc-dired-window-configuration)
1204
1205(defun vc-compatible-state (p q) 1180(defun vc-compatible-state (p q)
1206 "Controls which states can be in the same commit." 1181 "Controls which states can be in the same commit."
1207 (or 1182 (or
@@ -1979,140 +1954,8 @@ See Info node `Merging'."
1979;;;###autoload 1954;;;###autoload
1980(defalias 'vc-resolve-conflicts 'smerge-ediff) 1955(defalias 'vc-resolve-conflicts 'smerge-ediff)
1981 1956
1982;; The VC directory major mode. Coopt Dired for this. 1957;; VC Dired hook
1983;; All VC commands get mapped into logical equivalents. 1958;; FIXME: Remove Dired support when vc-dir is ready.
1984
1985(defvar vc-dired-switches)
1986(defvar vc-dired-terse-mode)
1987
1988(defvar vc-dired-mode-map
1989 (let ((map (make-sparse-keymap))
1990 (vmap (make-sparse-keymap)))
1991 (define-key map "\C-xv" vmap)
1992 (define-key map "v" vmap)
1993 (set-keymap-parent vmap vc-prefix-map)
1994 (define-key vmap "t" 'vc-dired-toggle-terse-mode)
1995 map))
1996
1997(define-derived-mode vc-dired-mode dired-mode "Dired under "
1998 "The major mode used in VC directory buffers.
1999
2000It works like Dired, but lists only files under version control, with
2001the current VC state of each file being indicated in the place of the
2002file's link count, owner, group and size. Subdirectories are also
2003listed, and you may insert them into the buffer as desired, like in
2004Dired.
2005
2006All Dired commands operate normally, with the exception of `v', which
2007is redefined as the version control prefix, so that you can type
2008`vl', `v=' etc. to invoke `vc-print-log', `vc-diff', and the like on
2009the file named in the current Dired buffer line. `vv' invokes
2010`vc-next-action' on this file, or on all files currently marked.
2011There is a special command, `*l', to mark all files currently locked."
2012 ;; define-derived-mode does it for us in Emacs-21, but not in Emacs-20.
2013 ;; We do it here because dired might not be loaded yet
2014 ;; when vc-dired-mode-map is initialized.
2015 (set-keymap-parent vc-dired-mode-map dired-mode-map)
2016 (add-hook 'dired-after-readin-hook 'vc-dired-hook nil t)
2017 ;; The following is slightly modified from files.el,
2018 ;; because file lines look a bit different in vc-dired-mode
2019 ;; (the column before the date does not end in a digit).
2020 ;; albinus: It should be done in the original declaration. Problem
2021 ;; is the optional empty state-info; otherwise ")" would be good
2022 ;; enough as delimeter.
2023 (set (make-local-variable 'directory-listing-before-filename-regexp)
2024 (let* ((l "\\([A-Za-z]\\|[^\0-\177]\\)")
2025 ;; In some locales, month abbreviations are as short as 2 letters,
2026 ;; and they can be followed by ".".
2027 (month (concat l l "+\\.?"))
2028 (s " ")
2029 (yyyy "[0-9][0-9][0-9][0-9]")
2030 (dd "[ 0-3][0-9]")
2031 (HH:MM "[ 0-2][0-9]:[0-5][0-9]")
2032 (seconds "[0-6][0-9]\\([.,][0-9]+\\)?")
2033 (zone "[-+][0-2][0-9][0-5][0-9]")
2034 (iso-mm-dd "[01][0-9]-[0-3][0-9]")
2035 (iso-time (concat HH:MM "\\(:" seconds "\\( ?" zone "\\)?\\)?"))
2036 (iso (concat "\\(\\(" yyyy "-\\)?" iso-mm-dd "[ T]" iso-time
2037 "\\|" yyyy "-" iso-mm-dd "\\)"))
2038 (western (concat "\\(" month s "+" dd "\\|" dd "\\.?" s month "\\)"
2039 s "+"
2040 "\\(" HH:MM "\\|" yyyy "\\)"))
2041 (western-comma (concat month s "+" dd "," s "+" yyyy))
2042 ;; Japanese MS-Windows ls-lisp has one-digit months, and
2043 ;; omits the Kanji characters after month and day-of-month.
2044 (mm "[ 0-1]?[0-9]")
2045 (japanese
2046 (concat mm l "?" s dd l "?" s "+"
2047 "\\(" HH:MM "\\|" yyyy l "?" "\\)")))
2048 ;; the .* below ensures that we find the last match on a line
2049 (concat ".*" s
2050 "\\(" western "\\|" western-comma "\\|" japanese "\\|" iso "\\)"
2051 s "+")))
2052 (and (boundp 'vc-dired-switches)
2053 vc-dired-switches
2054 (set (make-local-variable 'dired-actual-switches)
2055 vc-dired-switches))
2056 (set (make-local-variable 'vc-dired-terse-mode) vc-dired-terse-display)
2057 (let ((backend-name (symbol-name (vc-responsible-backend
2058 default-directory))))
2059 (setq mode-name (concat mode-name backend-name))
2060 ;; Add menu after `vc-dired-mode-map' has `dired-mode-map' as the parent.
2061 (let ((vc-dire-menu-map (copy-keymap vc-menu-map)))
2062 (define-key-after (lookup-key vc-dired-mode-map [menu-bar]) [vc]
2063 (cons backend-name vc-dire-menu-map) 'subdir)))
2064 (setq vc-dired-mode t))
2065
2066(defun vc-dired-toggle-terse-mode ()
2067 "Toggle terse display in VC Dired."
2068 (interactive)
2069 (if (not vc-dired-mode)
2070 nil
2071 (setq vc-dired-terse-mode (not vc-dired-terse-mode))
2072 (if vc-dired-terse-mode
2073 (vc-dired-hook)
2074 (revert-buffer))))
2075
2076(defun vc-dired-mark-locked ()
2077 "Mark all files currently locked."
2078 (interactive)
2079 (dired-mark-if (let ((f (dired-get-filename nil t)))
2080 (and f
2081 (not (file-directory-p f))
2082 (not (vc-up-to-date-p f))))
2083 "locked file"))
2084
2085(define-key vc-dired-mode-map "*l" 'vc-dired-mark-locked)
2086
2087(defun vc-dired-reformat-line (vc-info)
2088 "Reformat a directory-listing line.
2089Replace various columns with version control information, VC-INFO.
2090This code, like dired, assumes UNIX -l format."
2091 (beginning-of-line)
2092 (when (re-search-forward
2093 ;; Match link count, owner, group, size. Group may be missing,
2094 ;; and only the size is present in OS/2 -l format.
2095 "^..[drwxlts-]+ \\( *[0-9]+\\( [^ ]+ +\\([^ ]+ +\\)?[0-9]+\\)?\\) "
2096 (line-end-position) t)
2097 (replace-match (substring (concat vc-info " ") 0 10)
2098 t t nil 1)))
2099
2100(defun vc-dired-ignorable-p (filename)
2101 "Should FILENAME be ignored in VC-Dired listings?"
2102 (catch t
2103 ;; Ignore anything that wouldn't be found by completion (.o, .la, etc.)
2104 (dolist (ignorable completion-ignored-extensions)
2105 (let ((ext (substring filename
2106 (- (length filename)
2107 (length ignorable)))))
2108 (if (string= ignorable ext) (throw t t))))
2109 ;; Ignore Makefiles derived from something else
2110 (when (string= (file-name-nondirectory filename) "Makefile")
2111 (let* ((dir (file-name-directory filename))
2112 (peers (directory-files (or dir default-directory))))
2113 (if (or (member "Makefile.in" peers) (member "Makefile.am" peers))
2114 (throw t t))))
2115 nil))
2116 1959
2117(defun vc-dired-hook () 1960(defun vc-dired-hook ()
2118 "Reformat the listing according to version control. 1961 "Reformat the listing according to version control.
@@ -2190,72 +2033,6 @@ Called by dired after any portion of a vc-dired buffer has been read in."
2190 (goto-char (point-min)) 2033 (goto-char (point-min))
2191 (message "No changes pending under %s" default-directory))))) 2034 (message "No changes pending under %s" default-directory)))))
2192 2035
2193(defun vc-dired-purge ()
2194 "Remove empty subdirs."
2195 (goto-char (point-min))
2196 (while (dired-get-subdir)
2197 (forward-line 2)
2198 (if (dired-get-filename nil t)
2199 (if (not (dired-next-subdir 1 t))
2200 (goto-char (point-max)))
2201 (forward-line -2)
2202 (if (not (string= (dired-current-directory) default-directory))
2203 (dired-do-kill-lines t "")
2204 ;; We cannot remove the top level directory.
2205 ;; Just make it look a little nicer.
2206 (forward-line 1)
2207 (or (eobp) (kill-line))
2208 (if (not (dired-next-subdir 1 t))
2209 (goto-char (point-max))))))
2210 (goto-char (point-min)))
2211
2212(defun vc-dired-buffers-for-dir (dir)
2213 "Return a list of all vc-dired buffers that currently display DIR."
2214 (let (result)
2215 ;; Check whether dired is loaded.
2216 (when (fboundp 'dired-buffers-for-dir)
2217 (dolist (buffer (dired-buffers-for-dir dir))
2218 (with-current-buffer buffer
2219 (when vc-dired-mode
2220 (push buffer result)))))
2221 (nreverse result)))
2222
2223(defun vc-directory-resynch-file (file)
2224 "Update the entries for FILE in any VC Dired buffers that list it."
2225 ;;FIXME This needs to be implemented so it works for vc-dir
2226 (let ((buffers (vc-dired-buffers-for-dir (file-name-directory file))))
2227 (when buffers
2228 (mapcar (lambda (buffer)
2229 (with-current-buffer buffer
2230 (when (dired-goto-file file)
2231 ;; bind vc-dired-terse-mode to nil so that
2232 ;; files won't vanish when they are checked in
2233 (let ((vc-dired-terse-mode nil))
2234 (dired-do-redisplay 1)))))
2235 buffers))))
2236
2237;;;###autoload
2238(defun vc-directory (dir read-switches)
2239 "Create a buffer in VC Dired Mode for directory DIR.
2240
2241See Info node `VC Dired Mode'.
2242
2243With prefix arg READ-SWITCHES, specify a value to override
2244`dired-listing-switches' when generating the listing."
2245 (interactive "DDired under VC (directory): \nP")
2246 (let ((vc-dired-switches (concat vc-dired-listing-switches
2247 (if vc-dired-recurse "R" ""))))
2248 (if read-switches
2249 (setq vc-dired-switches
2250 (read-string "Dired listing switches: "
2251 vc-dired-switches)))
2252 (require 'dired)
2253 (require 'dired-aux)
2254 (switch-to-buffer
2255 (dired-internal-noselect (expand-file-name (file-name-as-directory dir))
2256 vc-dired-switches
2257 'vc-dired-mode))))
2258
2259;; VC status implementation 2036;; VC status implementation
2260 2037
2261;; Used to store information for the files displayed in the *VC status* buffer. 2038;; Used to store information for the files displayed in the *VC status* buffer.