about summary refs log tree commit diff
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@tvl.su>2024-08-27T21·48+0300
committertazjin <tazjin@tvl.su>2024-08-30T13·30+0000
commit4a4c21482b4856da069cb7163262db5cf9c6221e (patch)
tree69d34ea9a3f20c5eb57e8d7888b6241150f41e38
parentd235fd99c2fad038b624a2bf5475325dc56d86c6 (diff)
feat(tools/eaglemode): add command for opening Emacsclient r/8615
Adds a command that opens the current target in the file browser in Emacsclient.

Change-Id: Idbbec3905eb7763ce5bdc2931415db74bc5a5c31
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12367
Tested-by: BuildkiteCI
Reviewed-by: emery <emery@dmz.rs>
Reviewed-by: azahi <azat@bahawi.net>
-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);
+  '';
+}