mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-01 12:17:25 -05:00
fix(cli): show "restart Emacs" advice only if Emacs is running
Also fixes the case where it'll appear, unconditionally on 'doom install', where the advice doesn't make sense.
This commit is contained in:
@ -56,13 +56,21 @@ OPTIONS:
|
|||||||
during the execution of this command. Use --rebuild as well to do so for all
|
during the execution of this command. Use --rebuild as well to do so for all
|
||||||
packages."
|
packages."
|
||||||
:benchmark t
|
:benchmark t
|
||||||
(when (doom-profiles-bootloadable-p)
|
|
||||||
(call! '(profile sync "--all" "--reload")))
|
|
||||||
(when aot?
|
(when aot?
|
||||||
(after! straight
|
(after! straight
|
||||||
(setq straight--native-comp-available t)))
|
(setq straight--native-comp-available t)))
|
||||||
(when jobs
|
(when jobs
|
||||||
(setq native-comp-async-jobs-number (truncate jobs)))
|
(setq native-comp-async-jobs-number (truncate jobs)))
|
||||||
|
(let ((emacs-running?
|
||||||
|
(cl-loop for pid in (remove (emacs-pid) (list-system-processes))
|
||||||
|
for attrs = (process-attributes pid)
|
||||||
|
for args = (alist-get 'args attrs "")
|
||||||
|
if (string-match-p "^\\([^ ]+/\\)?[eE]macs" args)
|
||||||
|
if (not (string-match-p " --batch" args))
|
||||||
|
if (not (string-match-p " --script" args))
|
||||||
|
collect pid)))
|
||||||
|
(when (doom-profiles-bootloadable-p)
|
||||||
|
(call! '(profile sync "--all" "--reload")))
|
||||||
(run-hooks 'doom-before-sync-hook)
|
(run-hooks 'doom-before-sync-hook)
|
||||||
(add-hook 'kill-emacs-hook #'doom-sync--abort-warning-h)
|
(add-hook 'kill-emacs-hook #'doom-sync--abort-warning-h)
|
||||||
(print! (item "Using Emacs %s @ %s") emacs-version (path invocation-directory invocation-name))
|
(print! (item "Using Emacs %s @ %s") emacs-version (path invocation-directory invocation-name))
|
||||||
@ -100,14 +108,15 @@ OPTIONS:
|
|||||||
(unless noupdate? (doom-packages-update (not update?)))
|
(unless noupdate? (doom-packages-update (not update?)))
|
||||||
(doom-packages-purge purge? purge? purge? purge? purge?)
|
(doom-packages-purge purge? purge? purge? purge? purge?)
|
||||||
(when (doom-profile-generate)
|
(when (doom-profile-generate)
|
||||||
(print! (item "Restart Emacs for changes to take effect"))
|
(when emacs-running?
|
||||||
|
(print! (item "Restart Emacs for changes to take effect")))
|
||||||
(run-hooks 'doom-after-sync-hook))
|
(run-hooks 'doom-after-sync-hook))
|
||||||
(when (or rebuild? (not (file-exists-p doom-sync-info-file)))
|
(when (or rebuild? (not (file-exists-p doom-sync-info-file)))
|
||||||
(with-temp-file doom-sync-info-file
|
(with-temp-file doom-sync-info-file
|
||||||
(prin1 (cons emacs-version (doom-sync--system-hash))
|
(prin1 (cons emacs-version (doom-sync--system-hash))
|
||||||
(current-buffer))))
|
(current-buffer))))
|
||||||
t)
|
t)
|
||||||
(remove-hook 'kill-emacs-hook #'doom-sync--abort-warning-h)))
|
(remove-hook 'kill-emacs-hook #'doom-sync--abort-warning-h))))
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
|
Reference in New Issue
Block a user