parent
c862968f48
commit
80e9263b85
1 changed files with 9 additions and 3 deletions
|
@ -73,12 +73,14 @@ OPTIONS:
|
||||||
;; recompiled. This is necessary because Emacs byte-code is not
|
;; recompiled. This is necessary because Emacs byte-code is not
|
||||||
;; necessarily back/forward compatible across major versions, and many
|
;; necessarily back/forward compatible across major versions, and many
|
||||||
;; packages bake in hardcoded data at compile-time.
|
;; 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))
|
(to-rebuild nil))
|
||||||
(when (and old-version (not (equal old-version emacs-version)))
|
(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)
|
(print! (warn "Emacs version has changed since last sync (from %s to %s)") old-version emacs-version)
|
||||||
(setq to-rebuild t))
|
(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"))
|
(print! (warn "Your system has changed since last sync"))
|
||||||
(setq to-rebuild t))
|
(setq to-rebuild t))
|
||||||
(when (and to-rebuild (not rebuild?) (not (doom-cli-context-suppress-prompts-p context)))
|
(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))
|
(run-hooks 'doom-after-sync-hook))
|
||||||
(when (or rebuild? (not (file-exists-p doom-cli-sync-info-file)))
|
(when (or rebuild? (not (file-exists-p doom-cli-sync-info-file)))
|
||||||
(with-temp-file 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)
|
t)
|
||||||
(remove-hook 'kill-emacs-hook #'doom-sync--abort-warning-h)))
|
(remove-hook 'kill-emacs-hook #'doom-sync--abort-warning-h)))
|
||||||
|
|
||||||
|
@ -109,6 +112,9 @@ OPTIONS:
|
||||||
;;
|
;;
|
||||||
;;; Helpers
|
;;; Helpers
|
||||||
|
|
||||||
|
(defun doom-sync--system-hash ()
|
||||||
|
(sxhash (list doom-local-dir system-type system-configuration-features)))
|
||||||
|
|
||||||
(defun doom-sync--abort-warning-h ()
|
(defun doom-sync--abort-warning-h ()
|
||||||
(print! (warn "Script was abruptly aborted, leaving Doom in an incomplete state!"))
|
(print! (warn "Script was abruptly aborted, leaving Doom in an incomplete state!"))
|
||||||
(print! (item "Run 'doom sync' to repair it.")))
|
(print! (item "Run 'doom sync' to repair it.")))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue