1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-12-10 19:11:06 +01:00

services/emacs: add option to set emacsclient as the default editor (#2545)

* services/emacs: add `defaultEditor` option

Sets `emacsclient` as the default editor using the `EDITOR` environment variable.
This commit is contained in:
rcerc 2022-01-10 02:17:13 -05:00 committed by GitHub
parent 05d655146b
commit f3be3cda6a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 63 additions and 1 deletions

View file

@ -0,0 +1,24 @@
{ config, lib, pkgs, ... }:
{
nixpkgs.overlays = [
(self: super: {
# Use `cat` instead of `echo` to prevent arguments from being
# interpreted as an option.
emacs = pkgs.writeShellScriptBin "emacsclient"
''${pkgs.coreutils}/bin/cat <<< "$*"'';
})
];
services.emacs = {
defaultEditor = true;
enable = true;
};
nmt.script = "source ${
pkgs.substituteAll {
inherit (pkgs) coreutils;
src = ./emacs-default-editor.sh;
}
}";
}