From 38824f84201d26453ce935c5136a05cee14b2cd0 Mon Sep 17 00:00:00 2001 From: "Tom Breton (Tehom)" Date: Sat, 11 Dec 2010 15:28:00 -0500 Subject: [PATCH] Bugfix: dir names are now absolute. Factored out dir file lister. --- elinstall.el | 72 ++++++++++++++++++++++++++++++++++-------------------------- 1 file changed, 41 insertions(+), 31 deletions(-) diff --git a/elinstall.el b/elinstall.el index 417654a..e1d51cc 100644 --- a/elinstall.el +++ b/elinstall.el @@ -848,7 +848,7 @@ Returns a list whose elements are each a cons of: :arrange-preloads arrange-preloads))) ;;;_ . Finding actions -;;;_ , Informational +;;;_ , Utility ;;;_ . elinstall-dir-has-info ;;$$IMPROVE ME - Can this test be made more precise? @@ -858,6 +858,41 @@ DIR should be an absolute path." (or (string-match "/info/" dir) (directory-files dir nil "\\.info\\(-[0-9]+\\)?\\(\\.gz\\)?$"))) +;;;_ . elinstall-directory-files +(defun elinstall-directory-files (dirname) + "Return a list of files in directory DIRNAME, minus certain files. +The following files are omitted: + * Dot files + * Files that match an entry in `block-in-subtree'" + + (let* + ( + ;;Relative filenames of this directory's files. + (all-files + ;; Don't include dot files. If user really wants to + ;;explore one he can use (dir ".NAME") or (file ".NAME") + (directory-files dirname nil "[^\\.]")) + ;;We know our def-file isn't really source so remove it. + ;;We'd have removed it anyways after seeing file local vars. + (all-files + (remove def-file all-files)) + + (all-files + (delq nil + (mapcar + #'(lambda (filename) + (if + (and + block-in-subtree + (some + #'(lambda (blocked) + (string-match blocked filename)) + block-in-subtree)) + nil + filename)) + all-files)))) + all-files)) + ;;;_ , Workers ;;;_ . List of special variables used in this section @@ -950,33 +985,9 @@ Recurse just if RECURSE-DIRS-P" ;;treat/not treat them conditional on control variables. (let* ( - ;;Relative filenames of the source files. - (all-files - ;; Don't include dot files. If user really wants to - ;;explore one he can use (dir ".NAME") or (file ".NAME") - (directory-files dirname nil "[^\\.]")) - ;;We know our def-file isn't really source so remove it. - ;;We'd have removed it anyways after seeing file local vars. - (all-files - (remove def-file all-files)) - - (all-files - (delq nil - (mapcar - #'(lambda (filename) - (if - (and - block-in-subtree - (some - #'(lambda (blocked) - (string-match blocked filename)) - block-in-subtree)) - nil - filename)) - all-files))) - - ;;* Now blocked files have been removed * + (files (elinstall-directory-files dirname)) + ;;Relative filenames of elisp source (elisp-source-files (delq nil (mapcar @@ -985,10 +996,9 @@ Recurse just if RECURSE-DIRS-P" (string-match elinstall-elisp-regexp filename) filename nil)) - all-files))) + files))) ;;Absolute filenames of subdirectories. - ;;Don't accept any directories beginning with dot. (sub-dirs (if recurse-dirs-p (delq nil @@ -996,9 +1006,9 @@ Recurse just if RECURSE-DIRS-P" #'(lambda (filename) (if (file-directory-p filename) - filename + (expand-file-name filename dirname) nil)) - all-files)) + files)) '())) (load-path-here-p -- 2.11.4.GIT