feat(emacs): Set {EDITOR,VISUAL} to Emacs

- Includes a tiny wrapper script which connects to the Emacs daemon if it's
  running, or simply runs `emacs` otherwise.
This commit is contained in:
Madeleine Sydney
2025-02-15 12:32:29 -07:00
parent 273d4995a7
commit 84df241cfe

View File

@@ -56,12 +56,24 @@ let
done
'';
};
emacsclient-or-emacs = pkgs.writeShellScriptBin "emacsclient-or-emacs" ''
emacsclient --alternate-editor=${emacsWrapper}/bin/emacs "$@"
'';
in {
sydnix.impermanence.cache.directories = [
# Impermanence expects the path to be relative to ~.
(lib.removePrefix config.home.homeDirectory straightBaseDir)
];
# Set emacsclient as the default editor for the time being.
home.sessionVariables =
let e = "${emacsclient-or-emacs}/bin/emacsclient-or-emacs";
in {
"EDITOR" = e;
"VISUAL" = e;
};
home.file =
let default =
lib.removePrefix "${config.home.homeDirectory}/"
@@ -74,6 +86,7 @@ in {
home.packages = [
emacsWrapper
emacsclient-or-emacs
] ++ fontPackages;
# There's probably a better place to put this, but the current setup demands
@@ -85,5 +98,6 @@ in {
enable = true;
# Generate a desktop entry for emacsclient.
client.enable = true;
package = emacsWrapper;
};
}