emacs/lisp/+straight.el

43 lines
1.6 KiB
EmacsLisp

;;; +straight.el --- Straight.el extras -*- lexical-binding: t; -*-
;;; Commentary:
;;; Code:
(defun +straight-update-package (package &optional recursive)
"Update PACKAGE using straight.
This pulls, rebuilds, and loads the updated PACKAGE."
(interactive (list (straight--select-package "Update package"
#'straight--installed-p)
current-prefix-arg))
(+with-message (format "Pulling package `%s'%s" package
(if recursive " and deps" ""))
(funcall (if recursive
#'straight-pull-package-and-deps
#'straight-pull-package)
package
:from-upstream))
(+with-message (format "Rebuilding package `%s'%s" package
(if recursive " and deps" ""))
(straight-rebuild-package package recursive))
(+with-message (format "Loading package `%s'%s" package
(if recursive " and deps" ""))
(ignore-errors (load-library (symbol-name package)))
(when recursive
(dolist (dep (straight--get-transitive-dependencies package))
(ignore-errors (load-library (symbol-name package)))))))
(defun +straight-update-all (from-upstream)
"Update all installed packages using straight.
This pulls and rebuilds all packages at once. It does not reload
all of them, for reasons that should be obvious.
With a prefix argument, it also pulls the packages FROM-UPSTREAM."
(interactive "P")
(straight-pull-recipe-repositories)
(straight-pull-all from-upstream)
(straight-rebuild-all))
(provide '+straight)
;;; +straight.el ends here