bin/ec: Use separate Emacs daemons per git repo
This commit is contained in:
24
bin/ec
24
bin/ec
@@ -1,9 +1,19 @@
|
||||
#!/bin/bash
|
||||
echo "Display: $DISPLAY"
|
||||
if [ -z "$DISPLAY" ]; then
|
||||
# echo "Searching for text Emacs"
|
||||
emacsclient -a "" -t "$@"
|
||||
else
|
||||
# echo "Searching for GUI Emacs"
|
||||
emacsclient -n -a "" -c "$@"
|
||||
if [ "$PARENT_REPO" == "" ] ; then
|
||||
PARENT_REPO=$(find-parent-repo)
|
||||
if [ "$PARENT_REPO" == "" ] ; then
|
||||
echo "No repo found, using unnamed/common daemon."
|
||||
else
|
||||
REPO_NAME=$(basename $PARENT_REPO)
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user