Files
nix-doom-emacs/advice.el
László Vaskó 314de52ee4 Prevent doom to kill emacs before dumping package list
New behavior is introduced here:
> commit e632871a115528a9c1ce90d7d2147873009716eb
> Author: Henrik Lissner <henrik@lissner.net>
> 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.
2020-08-30 19:12:42 +02:00

39 lines
1.7 KiB
EmacsLisp

;;; -*- lexical-binding: t; -*-
;;; Skip Emacs's own package verification and let Nix do it for us.
;;;
;;; Having gnupg around the build triggers Emacs to use it for package signature
;;; verification. This would not work anyway because the build sandbox does not
;;; 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
: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)))
(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)
(message "%s \n[nix-doom-emacs] --> answering NO" q)
nil))
;;; org is not installed from git, so no fixup is needed
(advice-add '+org-fix-package-h
:override (lambda (&rest r)))
;; just use straight provided by nix
(advice-add 'doom-initialize-core-packages
:override (lambda (&rest r) (require 'straight)))