forked from vlaci/nix-doom-emacs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
advice.el
55 lines (47 loc) · 2.42 KB
/
advice.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
;;; -*- 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)
;;; For gccEmacs compatibility
(with-eval-after-load "comp"
;; The advice for 'kill-emacs would result in eln files being written before
;; doom would set up proper load paths
(when (boundp 'comp-never-optimize-functions)
;; TODO Remove this when emacs 28 become stable.
(add-to-list 'comp-never-optimize-functions 'kill-emacs))
(when (boundp 'native-comp-never-optimize-functions)
(add-to-list 'native-comp-never-optimize-functions 'kill-emacs))
)
(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)
(princ (format "%s\n" output) 'external-debugging-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)))
;; don't try adding the git hooks
(advice-add 'doom-cli--ci-deploy-hooks
:override (lambda (&rest r)))
;; just use straight provided by nix
(advice-add 'doom-initialize-core-packages
:override (lambda (&rest r)
(require 'straight)
(straight--make-build-cache-available)))