Fix doom update #1584

It would no-op if you responded "y" to the 'update them?' prompt, and
proceed if you responded "n".

Doom must be in its rebellious phase.

Also relevant: #1585
This commit is contained in:
Henrik Lissner 2019-07-22 21:35:27 +02:00
parent 22404f1ec5
commit a301330603
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -166,46 +166,47 @@ a list of packages that will be updated."
(nconc specs (async-get (pop futures)))) (nconc specs (async-get (pop futures))))
(terpri) (terpri)
(if-let (specs (delq nil (cdr specs))) (if-let (specs (delq nil (cdr specs)))
(if (or auto-accept-p (if (not
(y-or-n-p (or auto-accept-p
(format! "%s\n\nThere %s %d package%s available to update. Update them?" (y-or-n-p
(mapconcat (format!
(lambda (spec) "%s\n\nThere %s %d package%s available to update. Update them?"
(cl-destructuring-bind (n pretime time recipe) spec (mapconcat
(straight--with-plist recipe (package) (lambda (spec)
(format! "+ %-33s %s commit(s) behind %s -> %s" (cl-destructuring-bind (n pretime time recipe) spec
(yellow package) (yellow n) (straight--with-plist recipe (package)
(format-time-string "%Y%m%d" pretime) (format! "+ %-33s %s commit(s) behind %s -> %s"
(format-time-string "%Y%m%d" time))))) (yellow package) (yellow n)
specs (format-time-string "%Y%m%d" pretime)
"\n") (format-time-string "%Y%m%d" time)))))
(if (cdr specs) "are" "is") specs
(length specs) "\n")
(if (cdr specs) "s" "")))) (if (cdr specs) "are" "is")
(terpri) (length specs)
(dolist (spec specs t) (if (cdr specs) "s" "")))))
(cl-destructuring-bind (n pretime time recipe) spec (ignore (print! (info "Aborted update")))
(straight--with-plist recipe (local-repo package) (terpri)
(let ((default-directory (straight--repos-dir local-repo))) (dolist (spec specs t)
(print! (start "Updating %S") package) (cl-destructuring-bind (n pretime time recipe) spec
;; HACK `straight' doesn't assume it would ever be used (straight--with-plist recipe (local-repo package)
;; non-interactively, but here we are. If the repo is (let ((default-directory (straight--repos-dir local-repo)))
;; dirty, the command will lock up, waiting for (print! (start "Updating %S") package)
;; interaction that will never come, so discard all local ;; HACK `straight' doesn't assume it would ever be used
;; changes. Doom doesn't want you modifying those anyway. ;; non-interactively, but here we are. If the repo is
(and (straight--get-call "git" "reset" "--hard") ;; dirty, the command will lock up, waiting for
(straight--get-call "git" "clean" "-ffd")) ;; interaction that will never come, so discard all local
(straight-merge-package package) ;; changes. Doom doesn't want you modifying those anyway.
;; HACK `straight-rebuild-package' doesn't pick up that (and (straight--get-call "git" "reset" "--hard")
;; this package has changed, so we do it manually. Is (straight--get-call "git" "clean" "-ffd"))
;; there a better way? (straight-merge-package package)
(run-hook-with-args 'straight-use-package-pre-build-functions package) ;; HACK `straight-rebuild-package' doesn't pick up that
(straight--build-package recipe " ")) ;; this package has changed, so we do it manually. Is
(with-current-buffer (straight--process-get-buffer) ;; there a better way?
(with-silent-modifications (run-hook-with-args 'straight-use-package-pre-build-functions package)
(erase-buffer)))))) (straight--build-package recipe " "))
(print! (info "Aborted update")) (with-current-buffer (straight--process-get-buffer)
nil) (with-silent-modifications
(erase-buffer)))))))
(print! (success "No packages to update")) (print! (success "No packages to update"))
nil))) nil)))
(error (error