Make a temp file when standard in comes to emacs.

This supports using emacs as a PAGER
This commit is contained in:
Ivan Malison 2015-08-15 21:32:56 -07:00
parent 5357c25713
commit 63103674b9

View File

@ -1,8 +1,22 @@
#!/usr/bin/env zsh
function editor {
if is_osx; then
reattach-to-user-namespace emacsclient "$@"
else
emacsclient "$@"
fi
}
if [ -t 1 ]; then
TMP="$(mktemp -t emacs)"
echo $TMP
cat > "$TMP"
editor "$TMP" "$@"
rm "$TMP"
else
editor "$@"
fi
return 0