diff --git a/lisp/cli/sync.el b/lisp/cli/sync.el index 5d654a0f9..29be2b278 100644 --- a/lisp/cli/sync.el +++ b/lisp/cli/sync.el @@ -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.")))