diff options
Diffstat (limited to 'lisp/+straight.el')
-rw-r--r-- | lisp/+straight.el | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/lisp/+straight.el b/lisp/+straight.el new file mode 100644 index 0000000..d00ad9a --- /dev/null +++ b/lisp/+straight.el | |||
@@ -0,0 +1,41 @@ | |||
1 | ;;; +straight.el --- Straight.el extras -*- lexical-binding: t; -*- | ||
2 | |||
3 | ;;; Commentary: | ||
4 | |||
5 | ;;; Code: | ||
6 | |||
7 | (defun +straight-update-package (package &optional recursive) | ||
8 | "Update PACKAGE using straight. | ||
9 | This pulls, rebuilds, and loads the updated PACKAGE." | ||
10 | (interactive (list (straight--select-package "Update package" | ||
11 | #'straight--installed-p) | ||
12 | current-prefix-arg)) | ||
13 | (+with-message (format "Pulling package `%s'%s" package | ||
14 | (if recursive " and deps" "")) | ||
15 | (funcall (if recursive | ||
16 | #'straight-pull-package-and-deps | ||
17 | #'straight-pull-package) | ||
18 | package | ||
19 | :from-upstream)) | ||
20 | (+with-message (format "Rebuilding package `%s'%s" package | ||
21 | (if recursive " and deps" "")) | ||
22 | (straight-rebuild-package package recursive)) | ||
23 | (+with-message (format "Loading package `%s'%s" package | ||
24 | (if recursive " and deps" "")) | ||
25 | (ignore-errors (load-library (symbol-name package))) | ||
26 | (when recursive | ||
27 | (dolist (dep (straight--get-transitive-dependencies package)) | ||
28 | (ignore-errors (load-library (symbol-name package))))))) | ||
29 | |||
30 | (defun +straight-update-all (from-upstream) | ||
31 | "Update all installed packages using straight. | ||
32 | This pulls and rebuilds all packages at once. It does not reload | ||
33 | all of them, for reasons that should be obvious. | ||
34 | |||
35 | With a prefix argument, it also pulls the packages FROM-UPSTREAM." | ||
36 | (interactive "P") | ||
37 | (straight-pull-all from-upstream) | ||
38 | (straight-rebuild-all)) | ||
39 | |||
40 | (provide '+straight) | ||
41 | ;;; +straight.el ends here | ||