dev: merge from master

This commit is contained in:
Matt Nish-Lapidus 2024-08-27 09:52:50 -04:00
commit 06976a85a0
13 changed files with 58 additions and 39 deletions

View file

@ -13,9 +13,9 @@
;;
;;; Commands
(defcli-obsolete! ((build b)) (sync "--rebuild") "v3.0.0")
(defcli-obsolete! ((build b)) (sync "--rebuild") "3.0.0")
(defcli-obsolete! ((purge p)) (gc) "v3.0.0")
(defcli-obsolete! ((purge p)) (gc) "3.0.0")
;; TODO Rename to "doom gc" and move to its own file
(defcli! (gc)

View file

@ -73,12 +73,14 @@ OPTIONS:
;; recompiled. This is necessary because Emacs byte-code is not
;; necessarily back/forward compatible across major versions, and many
;; packages bake in hardcoded data at compile-time.
(pcase-let ((`(,old-version . ,old-host) (doom-file-read doom-cli-sync-info-file :by 'read :noerror t))
(pcase-let ((`(,old-version . ,hash)
(doom-file-read doom-cli-sync-info-file :by 'read :noerror t))
(to-rebuild nil))
(when (and old-version (not (equal old-version emacs-version)))
(print! (warn "Emacs version has changed since last sync (from %s to %s)") old-version emacs-version)
(setq to-rebuild t))
(when (and old-host (not (equal old-host (system-name))))
(when (and (integerp hash)
(not (equal hash (doom-sync--system-hash))))
(print! (warn "Your system has changed since last sync"))
(setq to-rebuild t))
(when (and to-rebuild (not rebuild?) (not (doom-cli-context-suppress-prompts-p context)))
@ -101,7 +103,8 @@ OPTIONS:
(run-hooks 'doom-after-sync-hook))
(when (or rebuild? (not (file-exists-p doom-cli-sync-info-file)))
(with-temp-file doom-cli-sync-info-file
(prin1 (cons emacs-version (system-name)) (current-buffer))))
(prin1 (cons emacs-version (doom-sync--system-hash))
(current-buffer))))
t)
(remove-hook 'kill-emacs-hook #'doom-sync--abort-warning-h)))
@ -109,6 +112,9 @@ OPTIONS:
;;
;;; Helpers
(defun doom-sync--system-hash ()
(sxhash (list doom-local-dir system-type system-configuration-features)))
(defun doom-sync--abort-warning-h ()
(print! (warn "Script was abruptly aborted, leaving Doom in an incomplete state!"))
(print! (item "Run 'doom sync' to repair it.")))

View file

@ -89,7 +89,7 @@ list is returned as-is."
;;
;;; Public library
(define-obsolete-function-alias 'doom-enlist 'ensure-list "v3.0.0")
(define-obsolete-function-alias 'doom-enlist 'ensure-list "3.0.0")
(defun doom-unquote (exp)
"Return EXP unquoted."

View file

@ -12,7 +12,7 @@ Emacs.")
(defvar doom-projectile-cache-purge-non-projects nil
"If non-nil, non-projects are purged from the cache on `kill-emacs-hook'.")
(define-obsolete-variable-alias 'doom-projectile-fd-binary 'doom-fd-executable "v3.0.0")
(define-obsolete-variable-alias 'doom-projectile-fd-binary 'doom-fd-executable "3.0.0")
(defvar doom-fd-executable (cl-find-if #'executable-find (list "fdfind" "fd"))
"The filename of the fd executable.

View file

@ -56,7 +56,7 @@ And jumps to your `doom!' block."
(defmacro doom--if-compile (command on-success &optional on-failure)
(declare (indent 2))
`(let ((default-directory doom-emacs-dir)
(exec-path (cons doom-bin-dir exec-path)))
(doom-bin (expand-file-name "doom" doom-bin-dir)))
;; Ensure the bin/doom operates with the same environment as this
;; running session.
(letenv! (("EMACS" (doom-path invocation-directory invocation-name))
@ -64,7 +64,7 @@ And jumps to your `doom!' block."
("DOOMDIR" doom-user-dir)
("DOOMLOCALDIR" doom-local-dir)
("DEBUG" (and doom-debug-mode "1")))
(with-current-buffer (compile ,command t)
(with-current-buffer (compile (format ,command doom-bin) t)
(let ((w (get-buffer-window (current-buffer))))
(select-window w)
(add-hook
@ -77,7 +77,7 @@ And jumps to your `doom!' block."
,on-failure))
nil 'local))))))
(defvar doom-reload-command "doom sync -B -e"
(defvar doom-reload-command "%s sync -B -e"
"Command that `doom/reload' runs.")
;;;###autoload
(defun doom/reload ()
@ -141,7 +141,7 @@ imported into Emacs."
(doom-load-envvars-file doom-env-file)
(message "Reloaded %S" (abbreviate-file-name doom-env-file))))))
(defvar doom-upgrade-command "doom upgrade -B --force"
(defvar doom-upgrade-command "%s upgrade -B --force"
"Command that `doom/upgrade' runs.")
;;;###autoload
(defun doom/upgrade ()