Refactor how we indent straight's progress output
More work up front, less work in the trenches.
This commit is contained in:
parent
4f676bd218
commit
7a348f8784
3 changed files with 43 additions and 29 deletions
|
@ -74,9 +74,7 @@ declaration) or dependency thereof that hasn't already been."
|
|||
(package local-repo)
|
||||
(let ((existed-p (file-directory-p (straight--repos-dir package))))
|
||||
(condition-case-unless-debug e
|
||||
(and (straight-use-package
|
||||
(intern package) nil nil
|
||||
(make-string (1- (or doom-format-indent 1)) 32))
|
||||
(and (straight-use-package (intern package))
|
||||
(not existed-p)
|
||||
(file-directory-p (straight--repos-dir package))
|
||||
(if-let (commit (cdr (assoc package versions-alist)))
|
||||
|
@ -103,29 +101,23 @@ declaration) or dependency thereof that hasn't already been."
|
|||
(print! (start "(Re)building %spackages...") (if force-p "all " ""))
|
||||
(straight--transaction-finalize)
|
||||
(print-group!
|
||||
(let ((straight-check-for-modifications
|
||||
(when (file-directory-p (straight--modified-dir))
|
||||
'(find-when-checking)))
|
||||
(straight--allow-find (and straight-check-for-modifications t))
|
||||
(straight--packages-not-to-rebuild
|
||||
(or straight--packages-not-to-rebuild (make-hash-table :test #'equal)))
|
||||
(straight-use-package-pre-build-functions
|
||||
straight-use-package-pre-build-functions)
|
||||
(n 0))
|
||||
(add-hook! 'straight-use-package-pre-build-functions (cl-incf n))
|
||||
(if force-p
|
||||
(let ((straight--packages-to-rebuild :all))
|
||||
(dolist (package (hash-table-keys straight--recipe-cache))
|
||||
(straight-use-package
|
||||
(intern package) nil nil
|
||||
(make-string (1- (or doom-format-indent 1)) 32))))
|
||||
(straight--make-package-modifications-available)
|
||||
(dolist (recipe (hash-table-values straight--recipe-cache))
|
||||
(straight--with-plist recipe (package local-repo no-build)
|
||||
(unless (or no-build (null local-repo))
|
||||
(straight-use-package
|
||||
(intern package) nil nil
|
||||
(make-string (or doom-format-indent 0) 32))))))
|
||||
(let* ((n 0)
|
||||
(straight-check-for-modifications
|
||||
(when (file-directory-p (straight--modified-dir))
|
||||
'(find-when-checking)))
|
||||
(straight--allow-find (and straight-check-for-modifications t))
|
||||
(straight--packages-not-to-rebuild
|
||||
(or straight--packages-not-to-rebuild (make-hash-table :test #'equal)))
|
||||
(straight--packages-to-rebuild
|
||||
(or (if force-p :all straight--packages-to-rebuild)
|
||||
(make-hash-table :test #'equal)))
|
||||
(straight-use-package-pre-build-functions
|
||||
(cons (lambda (&rest _) (cl-incf n))
|
||||
straight-use-package-pre-build-functions)))
|
||||
(unless force-p
|
||||
(straight--make-package-modifications-available))
|
||||
(dolist (package (hash-table-keys straight--recipe-cache))
|
||||
(straight-use-package (intern package)))
|
||||
(if (= n 0)
|
||||
(ignore (print! (success "No packages need rebuilding")))
|
||||
(print! (success "Rebuilt %d package(s)" n))
|
||||
|
|
|
@ -239,9 +239,18 @@ It will ensure that unneeded packages are removed, all needed packages are
|
|||
installed, autoloads files are up-to-date and no byte-compiled files have gone
|
||||
stale."
|
||||
:bare t
|
||||
(print! (start "Initiating a refresh of Doom Emacs..."))
|
||||
(print-group!
|
||||
(let (success)
|
||||
(let (success)
|
||||
;; Ensures that no pre-existing state pollutes the generation of the new
|
||||
;; autoloads files.
|
||||
(dolist (file (list doom-autoload-file doom-package-autoload-file))
|
||||
(delete-file file)
|
||||
(delete-file (byte-compile-dest-file file)))
|
||||
|
||||
(doom-initialize 'force 'noerror)
|
||||
(doom-initialize-modules)
|
||||
|
||||
(print! (start "Synchronizing your config with Doom Emacs..."))
|
||||
(print-group!
|
||||
(when (and (not inhibit-envvar-p)
|
||||
(file-exists-p doom-env-file))
|
||||
(doom-cli-reload-env-file 'force))
|
||||
|
|
|
@ -182,6 +182,19 @@ missing) and shouldn't be deleted.")
|
|||
(print! (warn "%s is not a valid answer, try again.") answer))
|
||||
(funcall fn))))))
|
||||
|
||||
(defadvice! doom--straight-respect-print-indent-a (args)
|
||||
:filter-args #'straight-use-package
|
||||
(cl-destructuring-bind
|
||||
(melpa-style-recipe &optional no-clone no-build cause interactive)
|
||||
args
|
||||
(list melpa-style-recipe no-clone no-build
|
||||
(if (and (not cause)
|
||||
(boundp 'doom-format-indent)
|
||||
(> doom-format-indent 0))
|
||||
(make-string (1- (or doom-format-indent 1)) 32)
|
||||
cause)
|
||||
interactive)))
|
||||
|
||||
|
||||
;;
|
||||
;;; Bootstrapper
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue