Commit 8b8568ef authored by Richard M. Stallman's avatar Richard M. Stallman
Browse files

(vc-registered): Look for a vc-registered handler.

parent 243e5206
......@@ -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"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment