aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1992-10-20 06:44:21 +0000
committerRichard M. Stallman1992-10-20 06:44:21 +0000
commit8b8568efad0cfc3f82bf469b4b71014c80676b81 (patch)
treec5881ed6954bd845cd91dea9363bbf6d28d2f530
parent243e5206344ca85db89dd5696a255bb1d132d49d (diff)
downloademacs-8b8568efad0cfc3f82bf469b4b71014c80676b81.tar.gz
emacs-8b8568efad0cfc3f82bf469b4b71014c80676b81.zip
(vc-registered): Look for a vc-registered handler.
-rw-r--r--lisp/vc-hooks.el58
1 files changed, 34 insertions, 24 deletions
diff --git a/lisp/vc-hooks.el b/lisp/vc-hooks.el
index a0795902624..bbaf0cfed08 100644
--- a/lisp/vc-hooks.el
+++ b/lisp/vc-hooks.el
@@ -5,7 +5,7 @@
5;; Author: Eric S. Raymond <esr@snark.thyrsus.com> 5;; Author: Eric S. Raymond <esr@snark.thyrsus.com>
6;; Version: 4.0 6;; Version: 4.0
7 7
8;; $Id: vc-hooks.el,v 1.2 1992/08/04 07:21:29 jimb Exp roland $ 8;; $Id: vc-hooks.el,v 1.3 1992/09/27 00:45:57 roland Exp rms $
9 9
10;; This file is part of GNU Emacs. 10;; This file is part of GNU Emacs.
11 11
@@ -65,29 +65,39 @@ the make-backup-files variable. Otherwise, prevents backups being made.")
65;;; actual version-control code starts here 65;;; actual version-control code starts here
66 66
67(defun vc-registered (file) 67(defun vc-registered (file)
68 ;; Search for a master corresponding to the given file 68 (let (handler (handlers file-name-handler-alist))
69 (let ((dirname (or (file-name-directory file) "")) 69 (save-match-data
70 (basename (file-name-nondirectory file))) 70 (while (and (consp handlers) (null handler))
71 (catch 'found 71 (if (and (consp (car handlers))
72 (mapcar 72 (stringp (car (car handlers)))
73 (function (lambda (s) 73 (string-match (car (car handlers)) file))
74 (let ((trial (format (car s) dirname basename))) 74 (setq handler (cdr (car handlers))))
75 (if (and (file-exists-p trial) 75 (setq handlers (cdr handlers))))
76 ;; Make sure the file we found with name 76 (if handler
77 ;; TRIAL is not the source file itself. 77 (funcall handler 'vc-registered file)
78 ;; That can happen with RCS-style names 78 ;; Search for a master corresponding to the given file
79 ;; if the file name is truncated 79 (let ((dirname (or (file-name-directory file) ""))
80 ;; (e.g. to 14 chars). See if either 80 (basename (file-name-nondirectory file)))
81 ;; directory or attributes differ. 81 (catch 'found
82 (or (not (string= dirname 82 (mapcar
83 (file-name-directory trial))) 83 (function (lambda (s)
84 (not (equal 84 (let ((trial (format (car s) dirname basename)))
85 (file-attributes file) 85 (if (and (file-exists-p trial)
86 (file-attributes trial))))) 86 ;; Make sure the file we found with name
87 (throw 'found (cons trial (cdr s))))))) 87 ;; TRIAL is not the source file itself.
88 vc-master-templates) 88 ;; That can happen with RCS-style names
89 nil) 89 ;; if the file name is truncated
90 )) 90 ;; (e.g. to 14 chars). See if either
91 ;; directory or attributes differ.
92 (or (not (string= dirname
93 (file-name-directory trial)))
94 (not (equal
95 (file-attributes file)
96 (file-attributes trial)))))
97 (throw 'found (cons trial (cdr s)))))))
98 vc-master-templates)
99 nil)
100 ))))
91 101
92(defun vc-backend-deduce (file) 102(defun vc-backend-deduce (file)
93 "Return the version-control type of a file, nil if it is not registered" 103 "Return the version-control type of a file, nil if it is not registered"