From 314de52ee480236b21fdab3f576ad1316ed9dee8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20Vask=C3=B3?= Date: Sun, 30 Aug 2020 18:46:19 +0200 Subject: [PATCH] Prevent doom to kill emacs before dumping package list New behavior is introduced here: > commit e632871a115528a9c1ce90d7d2147873009716eb > Author: Henrik Lissner > Date: Mon Aug 24 00:36:52 2020 -0400 > > core-cli: backport more refactors from rewrite > > Still a long way to go, but this introduces a few niceties for > debugging CLI failures: > > + The (extended) output of the last bin/doom command is now logged to > ~/.emacs.d/.local/doom.log > + If an error occurs, short backtraces are displayed whether or not you > have debug mode on. The full backtrace is written to > ~/.emacs.d/.local/doom.error.log. > + bin/doom now aborts with a warning if: > - The script itself or its parent directory is a symlink. It's fine if > ~/.emacs.d is symlinked though. > - Running bin/doom as root when your DOOMDIR isn't in /root/. > - If you're sporting Emacs 26.1 (now handled in the elisp side rather > than the /bin/sh shebang preamble). > + If a 'doom sync' was aborted prematurely, you'll be warned that Doom > was left in an inconsistent state and that you must run `doom sync` > again. > > May address #3746 The above commit introduces an explicit call to `(kill-emacs)` at the end of doom cli's main function. This conflicts with `nix-straight.el`'s package collection as it would run after doom is initialized. The commit disables `(kill-emacs)` method while package collection is in progress. --- advice.el | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/advice.el b/advice.el index 82f2d96..675b0fc 100644 --- a/advice.el +++ b/advice.el @@ -7,15 +7,22 @@ ;;; have a properly configured user home and environment. (setq package-check-signature nil) +(defun nix-straight-inhibit-kill-emacs (arg) + (message "[nix-doom-emacs] Inhibiting (kill-emacs)")) + (advice-add 'nix-straight-get-used-packages - :before (lambda (&rest r) + :around (lambda (orig-fn &rest r) (message "[nix-doom-emacs] Advising doom installer to gather packages to install...") (advice-add 'doom-autoloads-reload :override (lambda (&optional file force-p) (message "[nix-doom-emacs] Skipping generating autoloads..."))) (advice-add 'doom--print :override (lambda (output) - (message output))))) + (message output))) + (advice-add 'kill-emacs + :override #'nix-straight-inhibit-kill-emacs) + (apply orig-fn r) + (advice-remove 'kill-emacs 'nix-straight-inhibit-kill-emacs))) (advice-add 'y-or-n-p :override (lambda (q)