emacs: add versatile "emacsWrapper"

"emacsWrapper" replaces emacsWithPackages. In addition to "packagesFun",
emacsWrapper has an optional variable called "execStart". execStart can
be used to append elisp to the default site-start.el script. This is
useful for providing a way to load a user's .emacs.d/init.el
file. "emacsWithPackages" is implemented with emacsWrapper for
convenience and compatability.
This commit is contained in:
Matthew Bauer 2016-08-17 18:19:58 +00:00
parent 963d8cc3e0
commit 6ceedaaee4
2 changed files with 10 additions and 4 deletions

View file

@ -36,7 +36,10 @@ in customEmacsPackages.emacsWithPackages (epkgs: [ epkgs.evil epkgs.magit ])
with lib; let inherit (self) emacs; in
packagesFun: # packages explicitly requested by the user
{
packagesFun ? [], # packages explicitly requested by the user
extraStart ? ""
}:
let
explicitRequires =
@ -53,7 +56,7 @@ stdenv.mkDerivation {
# Store all paths we want to add to emacs here, so that we only need to add
# one path to the load lists
deps = runCommand "emacs-packages-deps"
{ inherit explicitRequires lndir emacs; }
{ inherit explicitRequires lndir emacs extraStart; }
''
mkdir -p $out/bin
mkdir -p $out/share/emacs/site-lisp
@ -96,6 +99,7 @@ stdenv.mkDerivation {
(load-file "$emacs/share/emacs/site-lisp/site-start.el")
(add-to-list 'load-path "$out/share/emacs/site-lisp")
(add-to-list 'exec-path "$out/bin")
$extraStart
EOF
# Byte-compiling improves start-up time only slightly, but costs nothing.

View file

@ -63,7 +63,7 @@ let
inherit fetchurl lib stdenv texinfo;
};
emacsWithPackages = import ../build-support/emacs/wrapper.nix {
emacsWrapper = import ../build-support/emacs/wrapper.nix {
inherit lib lndir makeWrapper stdenv runCommand;
};
@ -71,7 +71,9 @@ let
inherit emacs melpaBuild trivialBuild;
emacsWithPackages = emacsWithPackages self;
emacsWrapper = emacsWrapper self;
emacsWithPackages = packagesFun: emacsWrapper { inherit packagesFun; };
## START HERE