summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-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 @@
;; Author: Eric S. Raymond <esr@snark.thyrsus.com>
;; Version: 4.0
-;; $Id: vc-hooks.el,v 1.2 1992/08/04 07:21:29 jimb Exp roland $
+;; $Id: vc-hooks.el,v 1.3 1992/09/27 00:45:57 roland Exp rms $
;; This file is part of GNU Emacs.
@@ -65,29 +65,39 @@ the make-backup-files variable. Otherwise, prevents backups being made.")
;;; actual version-control code starts here
(defun vc-registered (file)
- ;; Search for a master corresponding to the given file
- (let ((dirname (or (file-name-directory file) ""))
- (basename (file-name-nondirectory file)))
- (catch 'found
- (mapcar
- (function (lambda (s)
- (let ((trial (format (car s) dirname basename)))
- (if (and (file-exists-p trial)
- ;; Make sure the file we found with name
- ;; TRIAL is not the source file itself.
- ;; That can happen with RCS-style names
- ;; if the file name is truncated
- ;; (e.g. to 14 chars). See if either
- ;; directory or attributes differ.
- (or (not (string= dirname
- (file-name-directory trial)))
- (not (equal
- (file-attributes file)
- (file-attributes trial)))))
- (throw 'found (cons trial (cdr s)))))))
- vc-master-templates)
- nil)
- ))
+ (let (handler (handlers file-name-handler-alist))
+ (save-match-data
+ (while (and (consp handlers) (null handler))
+ (if (and (consp (car handlers))
+ (stringp (car (car handlers)))
+ (string-match (car (car handlers)) file))
+ (setq handler (cdr (car handlers))))
+ (setq handlers (cdr handlers))))
+ (if handler
+ (funcall handler 'vc-registered file)
+ ;; Search for a master corresponding to the given file
+ (let ((dirname (or (file-name-directory file) ""))
+ (basename (file-name-nondirectory file)))
+ (catch 'found
+ (mapcar
+ (function (lambda (s)
+ (let ((trial (format (car s) dirname basename)))
+ (if (and (file-exists-p trial)
+ ;; Make sure the file we found with name
+ ;; TRIAL is not the source file itself.
+ ;; That can happen with RCS-style names
+ ;; if the file name is truncated
+ ;; (e.g. to 14 chars). See if either
+ ;; directory or attributes differ.
+ (or (not (string= dirname
+ (file-name-directory trial)))
+ (not (equal
+ (file-attributes file)
+ (file-attributes trial)))))
+ (throw 'found (cons trial (cdr s)))))))
+ vc-master-templates)
+ nil)
+ ))))
(defun vc-backend-deduce (file)
"Return the version-control type of a file, nil if it is not registered"