aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2004-09-13 03:36:11 +0000
committerStefan Monnier2004-09-13 03:36:11 +0000
commitce9f8ffb025a1159bcbc5019c1e162c647025213 (patch)
tree1316594ce70fb223a3338fd1eab7a4a752730a83
parent2b4b4febb22320681411fc882a841ecd1efb3469 (diff)
downloademacs-ce9f8ffb025a1159bcbc5019c1e162c647025213.tar.gz
emacs-ce9f8ffb025a1159bcbc5019c1e162c647025213.zip
(vc-ignore-dir-regexp): New var.
(vc-registered): Use it. (vc-find-root): New fun.
-rw-r--r--lisp/ChangeLog4
-rw-r--r--lisp/vc-hooks.el40
2 files changed, 35 insertions, 9 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 02112a1208d..83f7c83c038 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,9 @@
12004-09-12 Stefan <monnier@iro.umontreal.ca> 12004-09-12 Stefan <monnier@iro.umontreal.ca>
2 2
3 * vc-hooks.el (vc-ignore-dir-regexp): New var.
4 (vc-registered): Use it.
5 (vc-find-root): New fun.
6
3 * emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine): 7 * emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine):
4 Don't tell to use \\{...} when it's already done. 8 Don't tell to use \\{...} when it's already done.
5 9
diff --git a/lisp/vc-hooks.el b/lisp/vc-hooks.el
index d6cd8208540..fef1431fe7d 100644
--- a/lisp/vc-hooks.el
+++ b/lisp/vc-hooks.el
@@ -1,12 +1,12 @@
1;;; vc-hooks.el --- resident support for version-control 1;;; vc-hooks.el --- resident support for version-control
2 2
3;; Copyright (C) 1992,93,94,95,96,98,99,2000,03,2004 3;; Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2003, 2004
4;; Free Software Foundation, Inc. 4;; Free Software Foundation, Inc.
5 5
6;; Author: FSF (see vc.el for full credits) 6;; Author: FSF (see vc.el for full credits)
7;; Maintainer: Andre Spiegel <spiegel@gnu.org> 7;; Maintainer: Andre Spiegel <spiegel@gnu.org>
8 8
9;; $Id: vc-hooks.el,v 1.167 2004/04/16 10:21:51 spiegel Exp $ 9;; $Id$
10 10
11;; This file is part of GNU Emacs. 11;; This file is part of GNU Emacs.
12 12
@@ -52,6 +52,12 @@ BACKEND, use `vc-handled-backends'.")
52(defvar vc-header-alist ()) 52(defvar vc-header-alist ())
53(make-obsolete-variable 'vc-header-alist 'vc-BACKEND-header) 53(make-obsolete-variable 'vc-header-alist 'vc-BACKEND-header)
54 54
55(defvar vc-ignore-dir-regexp "\\`\\([\\/][\\/]\\|/net/\\|/afs/\\)\\'"
56 "Regexp matching directory names that are not under VC's control.
57The default regexp prevents fruitless and time-consuming attempts
58to determine the VC status in directories in which filenames are
59interpreted as hostnames.")
60
55(defcustom vc-handled-backends '(RCS CVS SVN SCCS Arch MCVS) 61(defcustom vc-handled-backends '(RCS CVS SVN SCCS Arch MCVS)
56 ;; Arch and MCVS come last because they are per-tree rather than per-dir. 62 ;; Arch and MCVS come last because they are per-tree rather than per-dir.
57 "*List of version control backends for which VC will be used. 63 "*List of version control backends for which VC will be used.
@@ -298,6 +304,20 @@ non-nil if FILE exists and its contents were successfully inserted."
298 (set-buffer-modified-p nil) 304 (set-buffer-modified-p nil)
299 t)) 305 t))
300 306
307(defun vc-find-root (file witness)
308 "Find the root of a checked out project.
309The function walks up the directory tree from FILE looking for WITNESS.
310If WITNESS if not found, return nil, otherwise return the root."
311 (let ((root nil))
312 (while (not (or root
313 (equal file (setq file (file-name-directory file)))
314 (null file)
315 (string-match vc-ignore-dir-regexp file)))
316 (if (file-exists-p (expand-file-name witness file))
317 (setq root file)
318 (setq file (directory-file-name file))))
319 root))
320
301;; Access functions to file properties 321;; Access functions to file properties
302;; (Properties should be _set_ using vc-file-setprop, but 322;; (Properties should be _set_ using vc-file-setprop, but
303;; _retrieved_ only through these functions, which decide 323;; _retrieved_ only through these functions, which decide
@@ -315,11 +335,13 @@ on the result of a previous call, use `vc-backend' instead. If the
315file was previously registered under a certain backend, then that 335file was previously registered under a certain backend, then that
316backend is tried first." 336backend is tried first."
317 (let (handler) 337 (let (handler)
318 (if (boundp 'file-name-handler-alist) 338 (cond
319 (setq handler (find-file-name-handler file 'vc-registered))) 339 ((string-match vc-ignore-dir-regexp (file-name-directory file)) nil)
320 (if handler 340 ((and (boundp 'file-name-handler-alist)
321 ;; handler should set vc-backend and return t if registered 341 (setq handler (find-file-name-handler file 'vc-registered)))
322 (funcall handler 'vc-registered file) 342 ;; handler should set vc-backend and return t if registered
343 (funcall handler 'vc-registered file))
344 (t
323 ;; There is no file name handler. 345 ;; There is no file name handler.
324 ;; Try vc-BACKEND-registered for each handled BACKEND. 346 ;; Try vc-BACKEND-registered for each handled BACKEND.
325 (catch 'found 347 (catch 'found
@@ -334,7 +356,7 @@ backend is tried first."
334 (cons backend vc-handled-backends)))) 356 (cons backend vc-handled-backends))))
335 ;; File is not registered. 357 ;; File is not registered.
336 (vc-file-setprop file 'vc-backend 'none) 358 (vc-file-setprop file 'vc-backend 'none)
337 nil)))) 359 nil)))))
338 360
339(defun vc-backend (file) 361(defun vc-backend (file)
340 "Return the version control type of FILE, nil if it is not registered." 362 "Return the version control type of FILE, nil if it is not registered."
@@ -869,5 +891,5 @@ Used in `find-file-not-found-functions'."
869 891
870(provide 'vc-hooks) 892(provide 'vc-hooks)
871 893
872;;; arch-tag: 2e5a6fa7-1d30-48e2-8bd0-e3d335f04f32 894;; arch-tag: 2e5a6fa7-1d30-48e2-8bd0-e3d335f04f32
873;;; vc-hooks.el ends here 895;;; vc-hooks.el ends here