i've started on something that shows each loaded feature,
and what features are required by the library in which that feature is
provided, and so on down the chain. The point is 1) to show what's
going on with features, and 2) to make it easier to unload a given
feature.
but, i've ran into a problem with loop-detection.
i'm able to filter it out, easily enough, when a feature's library
seems to require the feature itself, but i found another loop that i
don't know how to handle, namely:
apel-ver requires product, which requires pym, which requires apel-ver
looking at it, i wonder how the heck any of 'em gets loaded in the
first place, and I don't C well enough to make sense of how 'require'
works.
1) so, which of those three gets loaded first? and how does the reader
know when to return from the loop?
2) do you have any suggestions, on how i should avoid an endless
iteration in that loop of feature-file requirements?
this is what i've been using: `loadmanager-show-feature-tree', defined
below.
;; just doing this should show the loop:
; (require 'apel-ver)
; (loadmanager-walk-feature-tree '(apel-ver))
;; whose dependencies will be printed, cyclically, to the current
;; buffer, until `max-lisp-eval-depth' is exceeded.
(require 'cl)
(defvar *loadmanager-indent-step* 0
"used internally, by `loadmanager-show-feature-tree'")
(defun loadmanager-show-feature-tree (&optional other-window)
(interactive "P")
(funcall
(if other-window #'switch-to-buffer-other-window
#'switch-to-buffer)
(get-buffer-create "*Feature-tree*"))
(erase-buffer)
(setq *loadmanager-indent-step* 0)
(loadmanager-walk-feature-tree features))
(defun loadmanager-walk-feature-tree (feature-list)
(dolist (feature (copy-sequence feature-list))
(let* ((featfile (feature-file feature)))
(indent-to-column *loadmanager-indent-step*)
(insert-face (symbol-name feature) 'font-lock-reference-face)
(indent-to-column 30)
(insert ": ")
(insert-face featfile 'font-lock-string-face)
(newline 2)
(when featfile
(incf *loadmanager-indent-step* 2)
(loadmanager-walk-feature-tree
(remq feature (file-requires featfile)))
(decf *loadmanager-indent-step* 2)))))