Skip to content

Commit c3a6883

Browse files
committed
tweak(bootstrap): pin once and satch for better stability
1 parent 60f0583 commit c3a6883

File tree

2 files changed

+35
-32
lines changed

2 files changed

+35
-32
lines changed

core/me-bootstrap.el

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,19 @@
4343
;; Make the expanded code as minimal as possible, do not try to catch errors
4444
use-package-expand-minimally (not minemacs-debug-p))
4545

46+
;; Add the `:pin-ref' extension to integrate `straight' with `use-package'. And
47+
;; add support for `minemacs-disabled-packages'.
48+
(require 'me-use-package-extra)
49+
4650
;; Extra utilities
51+
;; Be cautious about the installed revision of `once' and `satch' as they aren't stable yet
4752
(use-package once
48-
:straight (:host github :repo "emacs-magus/once"))
53+
:straight (:host github :repo "emacs-magus/once")
54+
:pin-ref "a6f950c29c846a50018bc63695f24f611c1a58be")
4955

5056
(use-package satch
51-
:straight (:host github :repo "emacs-magus/satch.el"))
52-
53-
;; Add the `:pin-ref' extension to integrate `straight' with `use-package'. And
54-
;; add support for `minemacs-disabled-packages'.
55-
(require 'me-use-package-extra)
57+
:straight (:host github :repo "emacs-magus/satch.el")
58+
:pin-ref "77993b711cccf16702fdc8d21d8f8ba10d7bd0fb")
5659

5760

5861
(provide 'me-bootstrap)

core/me-use-package-extra.el

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -69,27 +69,27 @@
6969
;; from it. This advice also evaluates `use-package's conditional sections
7070
;; (`:if', `:when' and `:unless') to prevent installing packages with
7171
;; `straight'.
72-
(advice-add
73-
'use-package :around
74-
(satch-defun +use-package--check-if-disabled:around-a (origfn package &rest args)
75-
(if (or (+package-disabled-p package)
76-
(and (memq :if args)
77-
(not (and (memq :if args) (eval (+varplist-get args :if t)))))
78-
(and (memq :when args)
79-
(not (and (memq :when args) (eval (+varplist-get args :when t)))))
80-
(and (memq :unless args)
81-
(not (and (memq :unless args) (not (eval (+varplist-get args :unless t)))))))
82-
;; Register the package but don't enable it, useful when creating the lockfile,
83-
;; this is the official straight.el way for conditionally installing packages
84-
(when-let* ((recipe (+varplist-get args :straight t)))
85-
(let* ((recipe (if (eq recipe t) (list package) recipe))
86-
(car-recipe (and (listp recipe) (car recipe)))
87-
(car-recipe-is-pkg (and (symbolp car-recipe) (not (keywordp car-recipe))))
88-
(recipe (if (and car-recipe car-recipe-is-pkg) recipe (append (list package) recipe))))
89-
(straight-register-package recipe)))
90-
;; Otherwise, add it to the list of configured packages and apply the `use-package' form
91-
(add-to-list 'minemacs-configured-packages package t)
92-
(apply origfn package args))))
72+
(defun +use-package--check-if-disabled:around-a (origfn package &rest args)
73+
(if (or (+package-disabled-p package)
74+
(and (memq :if args)
75+
(not (and (memq :if args) (eval (+varplist-get args :if t)))))
76+
(and (memq :when args)
77+
(not (and (memq :when args) (eval (+varplist-get args :when t)))))
78+
(and (memq :unless args)
79+
(not (and (memq :unless args) (not (eval (+varplist-get args :unless t)))))))
80+
;; Register the package but don't enable it, useful when creating the lockfile,
81+
;; this is the official straight.el way for conditionally installing packages
82+
(when-let* ((recipe (+varplist-get args :straight t)))
83+
(let* ((recipe (if (eq recipe t) (list package) recipe))
84+
(car-recipe (and (listp recipe) (car recipe)))
85+
(car-recipe-is-pkg (and (symbolp car-recipe) (not (keywordp car-recipe))))
86+
(recipe (if (and car-recipe car-recipe-is-pkg) recipe (append (list package) recipe))))
87+
(straight-register-package recipe)))
88+
;; Otherwise, add it to the list of configured packages and apply the `use-package' form
89+
(add-to-list 'minemacs-configured-packages package t)
90+
(apply origfn package args)))
91+
92+
(advice-add 'use-package :around #'+use-package--check-if-disabled:around-a)
9393

9494
;; If you want to keep the `+use-package--check-if-disabled:around-a' advice after
9595
;; loading MinEmacs' modules. You need to set in in your
@@ -99,11 +99,11 @@
9999
;; The previous advice will be removed after loading MinEmacs packages to avoid
100100
;; messing with the user configuration (for example, if the user manually
101101
;; install a disabled package).
102-
(add-hook
103-
'minemacs-after-loading-modules-hook
104-
(satch-defun +use-package--remove-check-if-disabled-advice-h ()
105-
(unless +use-package-keep-checking-for-disabled-p
106-
(advice-remove 'use-package '+use-package--check-if-disabled:around-a)))))
102+
(defun +use-package--remove-check-if-disabled-advice-h ()
103+
(unless +use-package-keep-checking-for-disabled-p
104+
(advice-remove 'use-package '+use-package--check-if-disabled:around-a)))
105+
106+
(add-hook 'minemacs-after-loading-modules-hook #'+use-package--remove-check-if-disabled-advice-h))
107107

108108

109109
(provide 'me-use-package-extra)

0 commit comments

Comments
 (0)