emacs-twist/twist.nix

Automatically generating a package-quickstart

Closed this issue · 4 comments

To speed up Emacs I've been experimenting with having a derivation that generates package-quickstart via a derivation. I currently do this (given an Emacs package with all packages on path):

trivialBuild {
  pname = "config-package-quickstart";
  inherit version;

  dontUnpack = true;

  buildPhase = ''
    emacs --batch --quick \
      --load package \
      --eval '(setq package-quickstart-file "package-quickstart.el")' \
      --eval '(setq package-quickstart t)' \
      --funcall package-quickstart-refresh
  '';
}

I think package-quickstart integration into the nix Emacs Eco-system could be beneficial. Since it is a build-time thing that is dependent on it's inputs.

Twist doesn't depend on, or integrate with, package.el. At first, I tried to generate directories so package.el can load them using subdirs, but the directory conventions required more code to work with, so I dropped the integration. With the wrapper in pkgs/emacs/wrapper.el, it generates load-path at build time, which will make startup as fast as possible.

With twist, package.el is not required, so I have the following code in early-init.el to disable package:

(setq package-enable-at-startup nil)
(setq package-quickstart nil)

It is possible to integrate with package.el, but it will require more code.

Hmm, so perhaps that is wasted effort, perhaps what package-quickstart is trying to achieve could be supported with twist. The point of the package-quickstart is to generate one big file with all autoloads from all packages and then also byte-compile it.

If I remember correctly it was much faster to load one file instead of having a huge load-path with several files. Will have to explore this further. For now I will try to disable this optimization since it is not used anyways.

The reason I was trying to integrate with package-quickstart was to avoid having to do the work that had already been done by the GNU Emacs community.

The reason I was trying to integrate with package-quickstart was to avoid having to do the work that had already been done by the GNU Emacs community.

I think that's generally a good intension, but versioned directories would require more effort for me.

If I remember correctly it was much faster to load one file instead of having a huge load-path with several files.

That's handled by the wrapper. I know it is not for everyone, but it works for me. My Emacs starts in about 0.3 second.