bin/ec: Use separate Emacs daemons per git repo

This commit is contained in:
Paul Walker
2023-12-12 13:05:55 +00:00
parent b6b0a052a3
commit 03e651a9e8

22
bin/ec
View File

@@ -1,9 +1,19 @@
#!/bin/bash #!/bin/bash
echo "Display: $DISPLAY" if [ "$PARENT_REPO" == "" ] ; then
if [ -z "$DISPLAY" ]; then PARENT_REPO=$(find-parent-repo)
# echo "Searching for text Emacs" if [ "$PARENT_REPO" == "" ] ; then
emacsclient -a "" -t "$@" echo "No repo found, using unnamed/common daemon."
else else
# echo "Searching for GUI Emacs" REPO_NAME=$(basename $PARENT_REPO)
emacsclient -n -a "" -c "$@" if [ -n "$REPO_NAME" ] ; then
echo "Using Emacs daemon $REPO_NAME"
SOCKET_ARGS="-s $REPO_NAME"
fi
fi
fi
if [ -z "$DISPLAY" ]; then
emacsclient $SOCKET_ARGS -a "" -t "$@"
else
emacsclient $SOCKET_ARGS -a "" -n -c "$@"
fi fi