-
Notifications
You must be signed in to change notification settings - Fork 0
/
e
executable file
·35 lines (29 loc) · 969 Bytes
/
e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#! /bin/sh
# checkout /usr/loca/bin/gettext.sh at bajou for string echo
which emacsclient > /dev/null
ES=$?
if [ $ES -ne 0 ]; then
echo "emacsclient not found"
exit 1
fi
if [ $# = 0 ]; then
STATUS=$(emacsclient -n --eval '(progn (pop-to-buffer (generate-new-buffer "<stdin>")))')
echo $STATUS
# TODO use X from #<buffer X>
# awk -f e.awk
# ESCAPED=`sed -e '{
# s/[\]/\\\\\\\\/g
# s/["]/\\\\\"/g
# }'`
# ESCAPED=$(sed -e 's/\\/\\\\/g;s/\"/\\\"/g')
# emacsclient -n --eval "(with-current-buffer \"<stdin>\" (insert \"${ESCAPED}\n\"))"
while read -r LINE; do
ESCAPED=$(echo "$LINE"|sed -e 's/\\/\\\\/g;s/\"/\\\\"/g')
echo '(with-current-buffer "<stdin>" (insert "' "${ESCAPED}\n" '"))'
E=$(emacsclient -n --eval '(with-current-buffer "<stdin>" (insert "' "${ESCAPED}\n" '"))')
echo $E
done
else
emacsclient -n $*
fi
exit 0