Load non-packages.el autoloads

We were only pulling in autoloads files for packages installed via
packages.el. This was not that noticeable because all pinned packages
without custom derivations end up installed that way, but it does affect
extra packages (including the one pointed out in #11).

Try to fix this by including autoloads files in the top-level site-lisp
directory from emacsWithPackages.
This commit is contained in:
Marien Zwart 2024-06-22 13:30:32 +10:00
parent b28f009ef7
commit fa6fe4cf93
No known key found for this signature in database
5 changed files with 27 additions and 2 deletions

View file

@ -45,7 +45,8 @@ if [[ -n "$profileName" ]]; then
export HOME=$(mktemp -d) export HOME=$(mktemp -d)
export DOOMPROFILE="$profileName"; export DOOMPROFILE="$profileName";
fi fi
$runtimeShell $doomSource/bin/doomscript $buildProfile $runtimeShell $doomSource/bin/doomscript $buildProfile \
-l $deps/share/emacs/site-lisp
# Similar to audit-tmpdir.sh in nixpkgs. # Similar to audit-tmpdir.sh in nixpkgs.
if grep -q -F "$TMPDIR/" -r $out; then if grep -q -F "$TMPDIR/" -r $out; then

View file

@ -18,6 +18,21 @@
;; We skip Doom's normal install and initialization. ;; We skip Doom's normal install and initialization.
(require 'straight) (require 'straight)
;; Set from run!
(defvar site-lisp)
(defun generate-nix-autoloads ()
"Pull in autoloads for non-ELPA emacsWithPackages dependencies."
(let (filenames)
(dolist (filename (directory-files site-lisp))
(when (string-suffix-p "-autoloads.el" filename)
(push (expand-file-name filename site-lisp) filenames)))
(doom-autoloads--scan filenames doom-autoloads-excluded-files 'literal)))
(add-to-list
'doom-profile-generators
'("80-loaddefs-nix.auto.el" . generate-nix-autoloads))
;; Doom runs this with package.el activated, but suppresses activation during ;; Doom runs this with package.el activated, but suppresses activation during
;; normal startup. Store the side effects of activation in the profile to avoid ;; normal startup. Store the side effects of activation in the profile to avoid
;; (slow) package activation during normal startup. ;; (slow) package activation during normal startup.
@ -54,7 +69,8 @@
(add-to-list 'doom-autoloads-cached-vars 'package-activated-list) (add-to-list 'doom-autoloads-cached-vars 'package-activated-list)
(defcli! build-profile () (defcli! build-profile
((site-lisp ("-l" dir) "site-lisp directory to load autoloads from"))
"Write a Doom profile." "Write a Doom profile."
;; Load our generated profile's init.el. Both to get the profile right and to ;; Load our generated profile's init.el. Both to get the profile right and to
;; load the advice to make Doom not install straight. ;; load the advice to make Doom not install straight.

View file

@ -81,6 +81,8 @@ in {
interactive-without-loader = doomTest "no-profile" { config.default = true; } { profileName = ""; }; interactive-without-loader = doomTest "no-profile" { config.default = true; } { profileName = ""; };
interactive-no-profile-hack = doomTest "no-profile" { config.default = true; } { noProfileHack = true; }; interactive-no-profile-hack = doomTest "no-profile" { config.default = true; } { noProfileHack = true; };
cmake = doomTest "cmake" { lang.cc = true; } { };
org-re-reveal = doomTest "org-re-reveal" { lang.org = [ "+present" ]; } { }; org-re-reveal = doomTest "org-re-reveal" { lang.org = [ "+present" ]; } { };
# Various tests of module combinations. # Various tests of module combinations.

View file

@ -326,6 +326,7 @@ let
buildProfile = ./build-helpers/build-profile; buildProfile = ./build-helpers/build-profile;
initEl = ./init.el; initEl = ./init.el;
EMACS = lib.getExe emacsWithPackages; EMACS = lib.getExe emacsWithPackages;
inherit (emacsWithPackages) deps;
# Enable this to troubleshoot failures at this step. # Enable this to troubleshoot failures at this step.
#DEBUG = "1"; #DEBUG = "1";

View file

@ -41,6 +41,11 @@
(unless (string-search "/site-lisp/revealjs" org-re-reveal-root) (unless (string-search "/site-lisp/revealjs" org-re-reveal-root)
(error "org-re-reveal does not find our revealjs: %s" org-re-reveal-root))) (error "org-re-reveal does not find our revealjs: %s" org-re-reveal-root)))
(defun test-cmake ()
"Test cmake-mode autoloads are loaded."
(unless (functionp 'cmake-mode)
(error "cmake-mode not available")))
(defun test-doom () (defun test-doom ()
(let* ((out (getenv "out")) (let* ((out (getenv "out"))
(test (intern-soft (format "test-%s" (getenv "testName")))) (test (intern-soft (format "test-%s" (getenv "testName"))))