define-builder! now accepts functions/commands + better pwd handling

This commit is contained in:
Henrik Lissner 2016-04-16 21:39:11 -04:00
parent 38df38f9b6
commit 64221e9450

View file

@ -21,11 +21,14 @@ If ARG is nil this function calls `recompile', otherwise it calls
(user-error "No build command was set"))
(let ((build-file (cdr narf--build-command))
(build-cmd (car narf--build-command))
(default-directory (narf/project-root)))
(if (or (null build-file) (file-exists-p build-file))
(if (symbolp build-cmd)
(call-interactively build-cmd)
(compile (format build-cmd (or arg ""))))
(project-dir (narf/project-root)))
(if (or (null build-file) (f-exists? (f-expand build-file project-dir)))
(if (or (symbolp build-cmd) (functionp build-cmd))
(if (commandp build-cmd)
(call-interactively build-cmd)
(funcall build-cmd))
(let ((default-directory project-dir))
(compile (format build-cmd (or arg "")))))
(error "Could not build!"))))
;;;; Code running ;;;;;;;;;;;;;;;;;;;;;;