about summary refs log tree commit diff
path: root/tools/eaglemode/commands/emacsclient.nix
diff options
context:
space:
mode:
Diffstat (limited to 'tools/eaglemode/commands/emacsclient.nix')
-rw-r--r--tools/eaglemode/commands/emacsclient.nix26
1 files changed, 26 insertions, 0 deletions
diff --git a/tools/eaglemode/commands/emacsclient.nix b/tools/eaglemode/commands/emacsclient.nix
new file mode 100644
index 000000000000..bac3674120ee
--- /dev/null
+++ b/tools/eaglemode/commands/emacsclient.nix
@@ -0,0 +1,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);
+  '';
+}