Mercurial > emacs
changeset 1455:b5a0e08b0dbe
(vc-registered): Look for a vc-registered handler.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Tue, 20 Oct 1992 06:44:21 +0000 |
parents | 035c3f9fa12f |
children | 5f42c7680da7 |
files | lisp/vc-hooks.el |
diffstat | 1 files changed, 34 insertions(+), 24 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/vc-hooks.el Tue Oct 20 06:43:48 1992 +0000 +++ b/lisp/vc-hooks.el Tue Oct 20 06:44:21 1992 +0000 @@ -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 @@ ;;; 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"