diff --git a/dotfiles/lib/shellrc/aliases.sh b/dotfiles/lib/shellrc/aliases.sh index a48f7c67..98a1afa5 100644 --- a/dotfiles/lib/shellrc/aliases.sh +++ b/dotfiles/lib/shellrc/aliases.sh @@ -1,6 +1,3 @@ -alias emacs="emacsclient -c -n --server-filename=$(pwd)" -alias temacs="emacsclient -t" -alias cemacs="emacsclient -c -n" alias tmux="tmux -2" alias reload_tmux_conf="tmux source-file .tmux.conf" alias tmux_cb_to_remote_cb='tmux saveb - | linux_nc_paste_to_remote_clipboard' diff --git a/dotfiles/lib/shellrc/emacs.sh b/dotfiles/lib/shellrc/emacs.sh new file mode 100644 index 00000000..0eee1867 --- /dev/null +++ b/dotfiles/lib/shellrc/emacs.sh @@ -0,0 +1,12 @@ +alias emacs='_emacs -c' +alias cemacs'_emacs -c' +alias temacs'_emacs -t' + +function _emacs { + test -z "$(ps aux | grep -v grep | grep -i "\emacs -nw --daemon=.*`dotted_directory`")" && \emacs --daemon="$(dotted_directory)" + emacsclient $* -n --server-file="$(dotted_directory)" +} + +function dotted_directory { + pwd | sed "s:/:.:g" +}