From 96173ae1eae4ef6b179d5976fcd3a85cf9c46ccf Mon Sep 17 00:00:00 2001 From: "Tom Breton (Tehom)" Date: Fri, 12 Nov 2010 14:35:54 -0500 Subject: [PATCH] Changed strategy for parameters to finding actions; now uses special variables. --- elinstall.el | 115 +++++++++++++++++++++++++++++------------------------------ 1 file changed, 56 insertions(+), 59 deletions(-) diff --git a/elinstall.el b/elinstall.el index a27de0b..c6b5515 100644 --- a/elinstall.el +++ b/elinstall.el @@ -855,13 +855,18 @@ DIR should be an absolute path." (directory-files dir nil "\\.info\\(-[0-9]+\\)?\\(\\.gz\\)?$"))) ;;;_ . Workers -;;;_ , elinstall-actions-for-source-file -(defun elinstall-actions-for-source-file - (filename load-path-element dir parameters) - "Return a list of actions to do for FILENAME. -LOAD-PATH-ELEMENT, DIR, and PARAMETERS are interpreted as in -`elinstall-find-actions-by-spec' " +;;;_ , List of special variables used here +;;load-path-element - The relevant element of load-path +;;def-file - The file the autoload definitions etc will go into. +;;add-to-load-path-p - Controls whether to add to load-path. +;;;_ , elinstall-actions-for-source-file +(defun elinstall-actions-for-source-file (filename dir) + "Return a list of actions to do for FILENAME in DIR. +Special variables are as noted in \"List of special variables\"." + (declare (special + load-path-element)) + ;;$$IMPROVE ME take and treat a "force" argument. (let* ((full-path @@ -891,22 +896,21 @@ LOAD-PATH-ELEMENT, DIR, and PARAMETERS are interpreted as in `(byte-compile ,full-path) '()) `(add-file-autoloads - ,(elinstall-get-parameter - parameters 'def-file) + ,def-file ;;load-name relative to a member of load-path ,(file-name-sans-extension (file-relative-name full-path load-path-element)) - ,load-path-element ;;Is this still used? + ,load-path-element ,full-path)))) -;;;_ , elinstall-find-actions-by-spec +;;;_ , elinstall-find-actions-by-spec-x -(defun elinstall-find-actions-by-spec (spec load-path-element path parameters) - "Return a list of actions to do, controlled by SPEC and PARAMETERS. +(defun elinstall-find-actions-by-spec-x (spec path) + "Return a list of actions to do, controlled by SPEC." + (declare (special + load-path-element def-file add-to-load-path-p)) -LOAD-PATH-ELEMENT is the conceptual element of load-path that -surrounds DIR. It may not yet have been added to load-path." (if (consp spec) ;;$$IMPROVE ME by adding the other cases in the design. (case (car spec) @@ -917,27 +921,26 @@ surrounds DIR. It may not yet have been added to load-path." (second spec) dir))) - (elinstall-find-actions-by-spec + (elinstall-find-actions-by-spec-x (third spec) - load-path-element - new-path - parameters))) + new-path))) (all (apply #'nconc (mapcar #'(lambda (sub-spec) - (elinstall-find-actions-by-spec + (elinstall-find-actions-by-spec-x sub-spec - load-path-element - dir - parameters)) + dir)) (cdr spec)))) (file (elinstall-actions-for-source-file - filename load-path-element dir parameters)) - + filename dir)) + ;;$$ADD ME control, rather than trying to bind all control + ;;variables so we can safely bind one, will use set and + ;;unwind-protect. + (dir (let* ((dirname @@ -950,24 +953,18 @@ surrounds DIR. It may not yet have been added to load-path." dirname nil elinstall-elisp-regexp)) - (def-file - (elinstall-get-parameter - parameters 'def-file)) - (load-path-here (and elisp-source-files ;;List not empty. - (not - (elinstall-get-parameter - parameters 'block-add-to-load-path)))) + add-to-load-path-p)) (load-path-element (if load-path-here dirname load-path-element))) (append - ;;$$IMPROVE ME - do this only if there are loadable - ;;files. + ;;$$IMPROVE ME - remove the current deffile from + ;;this list. ;;Maybe arrange to add this directory to load-path. (if load-path-here `((add-to-load-path @@ -975,7 +972,7 @@ surrounds DIR. It may not yet have been added to load-path." ,load-path-element)) '()) - ;;$$IMPROVE ME - be controlled by parameters + ;;$$IMPROVE ME - be controlled by a control variable. ;;If any info files are present, do add-to-info-path ;;too. (if @@ -990,7 +987,7 @@ surrounds DIR. It may not yet have been added to load-path." ;; We want to get a value for generated-autoload-file ;; from the local variables section if it's there. ;;Use `elinstall-maybe-get-deffile' - ;; Otherwise we'll use `def-file' in parameters. + ;;$$FIXME Don't do directories, but maybe recurse on ;;them, if a flag is set. @@ -1000,29 +997,20 @@ surrounds DIR. It may not yet have been added to load-path." #'(lambda (filename) (elinstall-actions-for-source-file filename - load-path-element - dirname - parameters)) + dirname)) elisp-source-files))))) (load-path (append - `((add-to-load-path - (elinstall-get-parameter - parameters 'def-file) - path)) - - (elinstall-find-actions-by-spec - path - path ;;load-path-element - dir - (elinstall-get-parameter - parameters 'def-file)))) + `((add-to-load-path ,def-file ,path)) + (let + ((load-path-element path)) + (elinstall-find-actions-by-spec-x path dir)))) (def-file (let - ((new-def-file + ((def-file (expand-file-name (second spec) dir)) @@ -1034,20 +1022,30 @@ surrounds DIR. It may not yet have been added to load-path." (and for-preload (car for-preload)) `(preload-file ,(car for-preload) - ,new-def-file + ,def-file ,@(cdr for-preload)) '())) - (elinstall-find-actions-by-spec - (fourth spec) - load-path-element - dir - (elinstall-add-parameter parameters - 'def-file new-def-file)))))) + (elinstall-find-actions-by-spec-x + (fourth spec) dir))))) ;;$$IMPROVE ME by adding the other cases in the design. (case spec (t)))) +;;;_ , elinstall-find-actions-by-spec +(defun elinstall-find-actions-by-spec (spec load-path-element path def-file) + "" + + (let + ((load-path-element load-path-element) + (def-file def-file) + (add-to-load-path-p t)) + (declare (special + load-path-element def-file add-to-load-path-p)) + + (elinstall-find-actions-by-spec-x + spec path))) + ;;;_ . high-level work ;;;_ , elinstall-get-relevant-load-path (defun elinstall-get-relevant-load-path (actions) @@ -1081,8 +1079,7 @@ surrounds DIR. It may not yet have been added to load-path." spec nil dir - `( - (def-file . ,def-file )))) + def-file)) (stages (elinstall-segregate-actions actions)) (use-load-path (elinstall-get-relevant-load-path -- 2.11.4.GIT