From 783d51d4c46a7a01c067ef31f9fa160b201fd23c Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Fri, 28 Oct 2022 20:02:34 -0500 Subject: Add `yoke-dirs' and functions working on them I need to make yoke-dirs a better thing ... like, it should have the package name as the car and a plist of properties, like directory, load-directory, type, etc. So I can update stuff too. But later. --- lisp/yoke.el | 40 +++++++++++++++++++++++++++++----------- 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/lisp/yoke.el b/lisp/yoke.el index 46d30d5..1e1bc60 100644 --- a/lisp/yoke.el +++ b/lisp/yoke.el @@ -46,10 +46,13 @@ (defvar yoke-buffer "*yoke*" "Buffer to use for yoke process output.") +(defvar yoke-dirs nil + "List of directories managed by `yoke'.") + ;;; GET YOKED (defmacro yoke (package - &rest body) + &rest body) "Yoke PACKAGE to work with your Emacs. Execute BODY afterward. @@ -102,20 +105,23 @@ Execute BODY afterward. ;; Get prerequisite packages ,@(cl-loop for (pkg* . yoke-get-args) in depends - collect `(or (let ((dir (yoke-get ,@yoke-get-args - :dir ,(format "%s" pkg*)))) - (and dir - ,@(if autoload - `((yoke-generate-autoloads ',pkg* dir)) - '(t)))) - (cl-return-from ,pname - (format "Error fetching prerequiste: %s" - ',pkg*)))) + collect `(or + (let ((dir (yoke-get ,@yoke-get-args + :dir ,(format "%s" pkg*)))) + (and dir + ,@(if autoload + `((yoke-generate-autoloads ',pkg* dir)) + '(t)) + (add-to-list 'yoke-dirs dir nil #'string=))) + (cl-return-from ,pname + (format "Error fetching prerequiste: %s" + ',pkg*)))) ;; Download the package, generate autoloads ,@(when url `((let ((,dirvar (yoke-get ,@url :dir ,(format "%s" pkg)))) ,@(when autoload - `((yoke-generate-autoloads ',pkg ,dirvar)))))) + `((yoke-generate-autoloads ',pkg ,dirvar))) + (add-to-list 'yoke-dirs ,dirvar nil #'string=)))) ;; Evaluate the body, optionally after the features in `:after' ,@(cond (after `((eval-after ,after ,@body))) @@ -275,5 +281,17 @@ BODY after Emacs is finished initializing." (group (+ (not space))))) 1))) +(defun yoke-compile () + "Compile all elisp files in `yoke-dirs'." + (interactive) + (dolist (dir yoke-dirs) + (byte-recompile-directory dir 0))) + +(defun yoke-remove (dir) + (interactive + (completing-read "Remove: " yoke-dirs + nil :require-match)) + (delete-file dir :trash)) + (provide 'yoke) ;;; yoke.el ends here -- cgit 1.4.1-21-gabe81