Mercurial > hg > xemacs-beta
diff lisp/tl/file-detect.el @ 110:fe104dbd9147 r20-1b7
Import from CVS: tag r20-1b7
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:19:45 +0200 |
parents | 360340f9fd5f |
children |
line wrap: on
line diff
--- a/lisp/tl/file-detect.el Mon Aug 13 09:18:41 2007 +0200 +++ b/lisp/tl/file-detect.el Mon Aug 13 09:19:45 2007 +0200 @@ -4,7 +4,7 @@ ;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp> ;; Version: -;; $Id: file-detect.el,v 1.4 1997/03/08 23:26:56 steve Exp $ +;; $Id: file-detect.el,v 1.5 1997/03/16 03:05:44 steve Exp $ ;; Keywords: install, module ;; This file is part of tl (Tiny Library). @@ -117,31 +117,40 @@ (setq paths (cdr paths)) )))) +(defvar exec-suffix-list '("") + "*List of suffixes for executable.") + +(defun exec-installed-p (file &optional paths suffixes) + "Return absolute-path of FILE if FILE exists in PATHS. +If PATHS is omitted, `exec-path' is used. +If suffixes is omitted, `exec-suffix-list' is used. [file-detect.el]" + (or paths + (setq paths exec-path) + ) + (or suffixes + (setq suffixes exec-suffix-list) + ) + (catch 'tag + (while paths + (let ((stem (expand-file-name file (car paths))) + (sufs suffixes) + ) + (while sufs + (let ((file (concat stem (car sufs)))) + (if (file-exists-p file) + (throw 'tag file) + )) + (setq sufs (cdr sufs)) + )) + (setq paths (cdr paths)) + ))) + (defun module-installed-p (module &optional paths) "Return t if module is provided or exists in PATHS. If PATHS is omitted, `load-path' is used. [file-detect.el]" (or (featurep module) - (let ((name (symbol-name module))) - (if (null paths) - (setq paths load-path) - ) - (catch 'tag - (while paths - (let ((file (expand-file-name name (car paths)))) - (let ((elc-file (concat file ".elc"))) - (if (file-exists-p elc-file) - (throw 'tag elc-file) - )) - (let ((el-file (concat file ".el"))) - (if (file-exists-p el-file) - (throw 'tag el-file) - )) - (if (file-exists-p file) - (throw 'tag file) - ) - ) - (setq paths (cdr paths)) - ))))) + (exec-installed-p (symbol-name module) load-path '(".elc" ".el")) + )) ;;; @ end