forked from colonelpanic/dotfiles
Make it so that emacs looks for project root when deciding whether or not to start a new daemon.
This commit is contained in:
parent
b32765b9c5
commit
9b5bcafd7c
@ -1,12 +1,14 @@
|
|||||||
alias emacs='_emacs -c'
|
alias emacs='cemacs'
|
||||||
alias cemacs'_emacs -c'
|
alias cemacs='_emacs -c -n'
|
||||||
alias temacs'_emacs -t'
|
alias temacs='_emacs -t'
|
||||||
|
|
||||||
function _emacs {
|
function _emacs {
|
||||||
test -z "$(ps aux | grep -v grep | grep -i "\emacs -nw --daemon=.*`dotted_directory`")" && \emacs --daemon="$(dotted_directory)"
|
local directory="$(git rev-parse --show-toplevel 2> /dev/null || pwd)"
|
||||||
emacsclient $* -n --server-file="$(dotted_directory)"
|
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"
|
||||||
|
emacsclient $* --server-file="$server_name"
|
||||||
}
|
}
|
||||||
|
|
||||||
function dotted_directory {
|
function _dot_directory {
|
||||||
pwd | sed "s:/:.:g"
|
echo $1 | sed "s:/:.:g"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user