Mercurial > emacs
comparison lisp/vc-hooks.el @ 83204:6d9b668e8f94
Merged in changes from CVS trunk.
Patches applied:
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-537
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-538
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-539
Merge from gnus--rel--5.10
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-540
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-541
Merge from gnus--rel--5.10
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-542
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-543
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-544
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-545
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-546
Merge from gnus--rel--5.10
* miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-21
Merge from emacs--cvs-trunk--0
* miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-22
Update from CVS: lisp/nndb.el (require): Remove tcp and duplicate cl.
* miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-23
Update from CVS
* miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-24
lisp/nnimap.el (nnimap-open-connection): Remove extraneous end-paren
* miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-25
Update from CVS
* miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-26
Update from CVS
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-244
author | Karoly Lorentey <lorentey@elte.hu> |
---|---|
date | Mon, 13 Sep 2004 20:33:29 +0000 |
parents | 1a68e4b22355 6f014cde9d81 |
children | 0fc4928cc48e |
comparison
equal
deleted
inserted
replaced
83203:bc89b722d36f | 83204:6d9b668e8f94 |
---|---|
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 |
49 vc-BACKEND-master-templates. To enable or disable VC for a given | 49 vc-BACKEND-master-templates. To enable or disable VC for a given |
50 BACKEND, use `vc-handled-backends'.") | 50 BACKEND, use `vc-handled-backends'.") |
51 | 51 |
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 | |
55 (defvar vc-ignore-dir-regexp "\\`\\([\\/][\\/]\\|/net/\\|/afs/\\)\\'" | |
56 "Regexp matching directory names that are not under VC's control. | |
57 The default regexp prevents fruitless and time-consuming attempts | |
58 to determine the VC status in directories in which filenames are | |
59 interpreted as hostnames.") | |
54 | 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. |
58 Entries in this list will be tried in order to determine whether a | 64 Entries in this list will be tried in order to determine whether a |
296 (point-max))) | 302 (point-max))) |
297 (not pos))))))) | 303 (not pos))))))) |
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. | |
309 The function walks up the directory tree from FILE looking for WITNESS. | |
310 If 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 |
304 ;; if the property is already known or not. A property should | 324 ;; if the property is already known or not. A property should |
305 ;; only be retrieved by vc-file-getprop if there is no | 325 ;; only be retrieved by vc-file-getprop if there is no |
313 This function performs the check each time it is called. To rely | 333 This function performs the check each time it is called. To rely |
314 on the result of a previous call, use `vc-backend' instead. If the | 334 on the result of a previous call, use `vc-backend' instead. If the |
315 file was previously registered under a certain backend, then that | 335 file was previously registered under a certain backend, then that |
316 backend is tried first." | 336 backend 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 |
326 (let ((backend (vc-file-getprop file 'vc-backend))) | 348 (let ((backend (vc-file-getprop file 'vc-backend))) |
327 (mapcar | 349 (mapcar |
332 (if (or (not backend) (eq backend 'none)) | 354 (if (or (not backend) (eq backend 'none)) |
333 vc-handled-backends | 355 vc-handled-backends |
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." |
341 ;; `file' can be nil in several places (typically due to the use of | 363 ;; `file' can be nil in several places (typically due to the use of |
342 ;; code like (vc-backend buffer-file-name)). | 364 ;; code like (vc-backend buffer-file-name)). |
867 ;;(put 'vc-next-action 'menu-enable 'vc-mode) | 889 ;;(put 'vc-next-action 'menu-enable 'vc-mode) |
868 ;;(put 'vc-register 'menu-enable '(and buffer-file-name (not vc-mode))) | 890 ;;(put 'vc-register 'menu-enable '(and buffer-file-name (not vc-mode))) |
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 |