about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--tools/eaglemode/commands/emacsclient.nix21
1 files changed, 21 insertions, 0 deletions
diff --git a/tools/eaglemode/commands/emacsclient.nix b/tools/eaglemode/commands/emacsclient.nix
new file mode 100644
index 000000000000..d5aacd137fdc
--- /dev/null
+++ b/tools/eaglemode/commands/emacsclient.nix
@@ -0,0 +1,21 @@
+{ depot, pkgs, ... }:
+
+depot.tools.eaglemode.mkCommand {
+  name = "Emacsclient";
+  hotkey = "Ctrl+E";
+
+  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);
+  '';
+}