Update server file stuff for ubuntu.

This commit is contained in:
2014-10-27 13:28:27 +00:00
parent 26b00ec84c
commit 607d515ee0
2 changed files with 12 additions and 2 deletions

View File

@@ -6,10 +6,17 @@ alias ec='_emacs -n '
function _emacs {
local directory="$(git rev-parse --show-toplevel 2> /dev/null || pwd)"
local server_name="$(_dot_directory $directory)"
test -z "$(ps aux | grep -v grep | grep -i "emacs -nw --daemon=.*$server_name$")" && echo "Starting emacs with server name '$server_name'" && \emacs --daemon="$server_name"
if ! _emacs_daemon_exists "$server_name"; then
echo "Starting emacs with server name '$server_name'"
\emacs --daemon="$server_name"
fi
emacsclient $* --server-file="$server_name"
}
function _emacs_daemon_exists {
! test -z "$(ps aux | grep -v grep | grep -i "emacs.*--daemon=.*$1$")"
}
function _dot_directory {
echo $1 | sed "s:/:.:g"
}