# HG changeset patch # User Richard M. Stallman # Date 719563461 0 # Node ID b5a0e08b0dbed54b46019fd8c01851e0610bf34b # Parent 035c3f9fa12f04dafdf16247e3a8b1b7269b5983 (vc-registered): Look for a vc-registered handler. diff -r 035c3f9fa12f -r b5a0e08b0dbe lisp/vc-hooks.el --- 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 ;; 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"