about summary refs log tree commit diff
path: root/bins/bin/edit-file-in-emacs.sh
diff options
context:
space:
mode:
Diffstat (limited to 'bins/bin/edit-file-in-emacs.sh')
-rwxr-xr-xbins/bin/edit-file-in-emacs.sh7
1 files changed, 7 insertions, 0 deletions
diff --git a/bins/bin/edit-file-in-emacs.sh b/bins/bin/edit-file-in-emacs.sh
new file mode 100755
index 000000000000..0661da7335fe
--- /dev/null
+++ b/bins/bin/edit-file-in-emacs.sh
@@ -0,0 +1,7 @@
+#/usr/bin/env zsh
+
+file=$(mktemp -t "$USER-"XXXXXXXX.emacs-pager) || exit 127
+trap 'rm -f "$file"' EXIT
+trap 'exit 255' HUP INT QUIT TERM
+cat "$@" >"$file"
+emacsclient -e "(wc/edit-file-in-emacs \"$file\")"