Skip to content

Commit

Permalink
tweak(core): add minemacs-run-build-functions
Browse files Browse the repository at this point in the history
  • Loading branch information
abougouffa committed Jun 11, 2023
1 parent bdd3898 commit 04041bb
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions elisp/+minemacs.el
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,19 @@ DEPTH and LOCAL are passed as is to `add-hook'."
"Register build function FN to be called at the end of `minemacs-update'."
`(add-to-list 'minemacs--build-functions #',fn))

;;;###autoload
(defun minemacs-run-build-functions (&optional dont-ask-p)
"Run all build functions registered with `+register-build-function!'."
(interactive)
(dolist (fn minemacs--build-functions)
(message "MinEmacs: Running `%s'" fn)
(if dont-ask-p
;; Do not ask before installing
(cl-letf (((symbol-function 'yes-or-no-p) #'always)
((symbol-function 'y-or-n-p) #'always))
(funcall-interactively fn))
(funcall-interactively fn))))

;;;###autoload
(defun minemacs-update ()
"Update MinEmacs packages."
Expand All @@ -339,14 +352,8 @@ DEPTH and LOCAL are passed as is to `add-hook'."
(message "[MinEmacs]: Rebuilding packages")
(straight-rebuild-all)

;; Runn package-specific build functions (ex: `pdf-tools-install-noverify')
;; Runn package-specific build functions (ex: `pdf-tools-install')
(message "[MinEmacs]: Running additional package-specific build functions")
(dolist (fn minemacs--build-functions)
(message "MinEmacs: Running `%s'" fn)
;; Do not ask before installing
(cl-letf (((symbol-function 'yes-or-no-p) #'always)
((symbol-function 'y-or-n-p) #'always))
(funcall-interactively fn))))

(minemacs-run-build-functions 'dont-ask))

;;; +minemacs.el ends here

0 comments on commit 04041bb

Please sign in to comment.