summary refs log tree commit diff stats
path: root/lisp/+straight.el
blob: cba6c9668edfda1975f92be62fcad3fcef3b1739 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
;;; +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