diff --git a/dotfiles/lib/shellrc.sh b/dotfiles/lib/shellrc.sh index 42725cde..9da12c9b 100644 --- a/dotfiles/lib/shellrc.sh +++ b/dotfiles/lib/shellrc.sh @@ -20,10 +20,13 @@ if is_osx; then export CPPFLAGS=-Qunused-arguments add_to_back_of_path "/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/" export JAVA_HOME="$(find /Library/Java/JavaVirtualMachines -depth 1 | head -n 1)/Contents/Home" - add_to_front_of_path "$JAVA_HOME/bin" # Access gnu man pages. hash brew 2> /dev/null && export MANPATH="$(brew --prefix)/opt/coreutils/libexec/gnuman:$MANPATH" +else + export JAVA_HOME="$(update-alternatives --config java | get_cols ' -1' | head -n 1)" fi +add_to_front_of_path "$JAVA_HOME/bin" + add_to_back_of_path "$(dotfiles_directory)/resources/python" add_to_back_of_path "/usr/local/sbin" diff --git a/dotfiles/lib/shellrc/emacs.sh b/dotfiles/lib/shellrc/emacs.sh index 9527a37f..094e4395 100644 --- a/dotfiles/lib/shellrc/emacs.sh +++ b/dotfiles/lib/shellrc/emacs.sh @@ -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" }