From: Eric S. Raymond Date: Fri, 28 Dec 2007 13:29:41 +0000 (+0000) Subject: * vc-hooks.el, vc.el: Move vc-directory-exclusion-list from vc.el X-Git-Tag: emacs-pretest-23.0.90~8800 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=9c4b89d5a4a3507a27b9861af28efdf6cf2fd39a;p=emacs.git * vc-hooks.el, vc.el: Move vc-directory-exclusion-list from vc.el to vc-hooks.el so it will be available to other modes, such as speedbar.el. Also, teach it to recognize monotine state directories. * speedbar.el: Remove this mode's fragile assumptions about version-control systems. Instead, make it use logic from vc-hooks.el so it will become smarter whenever VC mode does. * vc-hooks.el: 'added is a real state, not a future hypothetical one. Fix the documentation. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index a2e69e254a1..83cb23b33b0 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,16 @@ 2007-12-28 Eric S. Raymond + * vc-hooks.el, vc.el: Move vc-directory-exclusion-list from vc.el + to vc-hooks.el so it will be available to other modes, such as + speedbar.el. Also, teach it to recognize monotine state directories. + + * speedbar.el: Remove this mode's fragile assumptions about + version-control systems. Instead, make it use logic from + vc-hooks.el so it will become smarter whenever VC mode does. + + * vc-hooks.el: 'added is a real state, not a future hypothetical + one. Fix the documentation. + * vc-bzr.el, vc-cvs.el, vc-git.el, vc-hg.el, vc-mcvs.el, vc-svn.el: Modify all instances of the dir-state back-end method to suppress keeping undo lists on the buffers holding astatus output, which diff --git a/lisp/speedbar.el b/lisp/speedbar.el index 6861615d468..fb93211ea0c 100644 --- a/lisp/speedbar.el +++ b/lisp/speedbar.el @@ -657,10 +657,11 @@ before speedbar has been loaded." speedbar-ignored-directory-regexp (speedbar-extension-list-to-regex val)))) -(defcustom speedbar-directory-unshown-regexp "^\\(CVS\\|RCS\\|SCCS\\|\\..*\\)\\'" +(defcustom speedbar-directory-unshown-regexp "^\\(\\..*\\)\\'" "*Regular expression matching directories not to show in speedbar. They should include commonly existing directories which are not -useful, such as version control." +useful. It is no longer necessary to include include version-control +directories here; see \\[vc-directory-exclusion-list\\]." :group 'speedbar :type 'string) @@ -1917,6 +1918,7 @@ the file-system." (while dir (if (not (or (string-match speedbar-file-unshown-regexp (car dir)) + (member (car dir) vc-directory-exclusion-list) (string-match speedbar-directory-unshown-regexp (car dir)))) (if (file-directory-p (car dir)) (setq dirs (cons (car dir) dirs)) @@ -2972,18 +2974,8 @@ the file being checked." "Return t if we should bother checking DIRECTORY for version control files. This can be overloaded to add new types of version control systems." (or - ;; Local CVS available in Emacs 21 - (and (fboundp 'vc-state) - (file-exists-p (concat directory "CVS/"))) - ;; Local RCS - (file-exists-p (concat directory "RCS/")) - ;; Local SCCS - (file-exists-p (concat directory "SCCS/")) - ;; Remote SCCS project - (let ((proj-dir (getenv "PROJECTDIR"))) - (if proj-dir - (file-exists-p (concat proj-dir "/SCCS")) - nil)) + (catch t (dolist (vcd vc-directory-exclusion-list) + (if (file-exists-p (concat directory vcd)) (throw t t))) nil) ;; User extension (run-hook-with-args-until-success 'speedbar-vc-directory-enable-hook directory) @@ -2991,29 +2983,11 @@ This can be overloaded to add new types of version control systems." (defun speedbar-this-file-in-vc (directory name) "Check to see if the file in DIRECTORY with NAME is in a version control system. -You can add new VC systems by overriding this function. You can +Automatically recognizes all VCs supported by VC mode. You can optimize this function by overriding it and only doing those checks that will occur on your system." (or - (if (fboundp 'vc-state) - ;; Emacs 21 handles VC state in a nice way. - (condition-case nil - (let ((state (vc-state (concat directory name)))) - (not (or (eq 'up-to-date state) - (null state)))) - ;; An error means not in a VC system - (error nil)) - (or - ;; RCS file name - (file-exists-p (concat directory "RCS/" name ",v")) - (file-exists-p (concat directory "RCS/" name)) - ;; Local SCCS file name - (file-exists-p (concat directory "SCCS/s." name)) - ;; Remote SCCS file name - (let ((proj-dir (getenv "PROJECTDIR"))) - (if proj-dir - (file-exists-p (concat proj-dir "/SCCS/s." name)) - nil)))) + (vc-backend (concat directory "/" name) ;; User extension (run-hook-with-args 'speedbar-vc-in-control-hook directory name) )) diff --git a/lisp/vc-hooks.el b/lisp/vc-hooks.el index 437b2267d7f..3657878232e 100644 --- a/lisp/vc-hooks.el +++ b/lisp/vc-hooks.el @@ -76,6 +76,13 @@ An empty list disables VC altogether." :version "23.1" :group 'vc) +(defcustom vc-directory-exclusion-list '("SCCS" "RCS" "CVS" "MCVS" + ".svn" ".git" ".hg" ".bzr" + "_MTN" "{arch}") + "List of directory names to be ignored when walking directory trees." + :type '(repeat string) + :group 'vc) + (defcustom vc-path (if (file-directory-p "/usr/sccs") '("/usr/sccs") diff --git a/lisp/vc.el b/lisp/vc.el index c5411718633..e8a481be3d3 100644 --- a/lisp/vc.el +++ b/lisp/vc.el @@ -620,12 +620,6 @@ These are passed to the checkin program by \\[vc-register]." :group 'vc :version "20.3") -(defcustom vc-directory-exclusion-list '("SCCS" "RCS" "CVS" "MCVS" ".svn" - ".git" ".hg" ".bzr" "{arch}") - "List of directory names to be ignored when walking directory trees." - :type '(repeat string) - :group 'vc) - (defcustom vc-diff-switches nil "A string or list of strings specifying switches for diff under VC. When running diff under a given BACKEND, VC concatenates the values of