about summary refs log tree commit diff
path: root/tools/eaglemode/commands/emacsclient.nix
blob: bac3674120ee40a99f7b018394846e2601fd306a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
{ depot, pkgs, ... }:

let
  em = depot.tools.eaglemode;
  icon = em.mkTGA "emacs" "${pkgs.emacs}/share/icons/hicolor/128x128/apps/emacs.png";
in
em.mkCommand {
  name = "Emacsclient";
  hotkey = "Ctrl+E";
  icon = "${icon}";

  description = ''
    Open target in Emacsclient.

    Emacs server must be running already for this to have any effect.
  '';

  code = ''
    ErrorIfNotSingleTarget();

    my @tgt=GetTgt();
    my $dir=$tgt[0];

    ExecOrError('${pkgs.emacs}/bin/emacsclient', '-n', $dir);
  '';
}