Closed alanz closed 2 years ago
Funny. I put some messaging in, and found evaluating the lambda contents to display it causes it to give a result. Without the (progn (message..)
clause I do not get any missing dep molds reported.
(defun me-usable-molds-requiring-deps ()
"Find molds that require dependencies to run."
(--remove
(let ((mold it)
(given-cond (me-get-in it '(:given :fn))))
(ignore-errors
(and
(> (length given-cond) 1)
(eq (car given-cond) 'and)
(progn (message "me-usable-molds-requiring-deps:got and:filtered=%s" (eval (cons 'and (--remove
(or
(and
(seqp it)
(-contains? it 'executable-find))
(and
(seqp it)
(-contains? it 'me-require)))
(cdr given-cond))))) t)
(me-with-mold-let mold
(lambda ()
(eval (cons 'and (--remove
(or
(and
(seqp it)
(-contains? it 'executable-find))
(and
(seqp it)
(-contains? it 'me-require)))
(cdr given-cond)))))))))
me-available-molds))
I think we need to do a deep traversal of the :given
clause.
e.g.
:given (:fn (and
url
(me-require 'json)
(executable-find "lighthouse") ;; npm i -g lighthouse
(or (executable-find "chromium")
(executable-find "chrome")
(file-exists-p "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"))))
will not currently find the executable-find
clauses under the or
.
You are correct! That is still at a basic implementation. I need to add some basic traversal functions eventually, although this also does the trick:
(let ((example (-flatten '(and
url
(me-require 'json)
(executable-find "lighthouse") ;; npm i -g lighthouse
(or (executable-find "chromium")
(executable-find "chrome")
(file-exists-p "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"))))))
(--> example
(--find-indices (eq it 'executable-find) it)
(--map (nth (+ 1 it) example) it)))
I do not have
org-ql
installed.If I open an org-mode file, and activate
WhatMoldsCanIUse?
it does not add a section noting the missing dependencies.Perhaps there should be a test for this, with a test mold having an impossible dependency to keep it from regressing.