diff options
Diffstat (limited to 'scripts/desktop/emacsclient')
-rwxr-xr-x | scripts/desktop/emacsclient | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/scripts/desktop/emacsclient b/scripts/desktop/emacsclient index c4fec064..e76ea6da 100755 --- a/scripts/desktop/emacsclient +++ b/scripts/desktop/emacsclient @@ -1,8 +1,20 @@ #!/bin/sh +# We also check whether there is something which looks like the installed +# Emacs running, as we do not want the in-tree emacsclient to try to connect +# to that, and whether there is a build in progress and no running daemon, as +# we don't want to start a new daemon until the build is finished. +# +# The idea is that I can always hit C-i RET without worrying about builds. + if [ -e "$HOME/src/emacs/admin/README.melete" \ -a -x "$HOME/src/emacs/lib-src/emacsclient" \ - -a -d "/usr/share/emacs-snapshot/site-lisp/elpa" ]; then + -a -d "/usr/share/emacs-snapshot/site-lisp/elpa" ] \ + && ! ps -o exe -u "$USER" -U "$USER" | grep -q $(command -v emacs) \ + && ! ( ! ps -o exe -u "$USER" -U "$USER" \ + | grep -q "$HOME/src/emacs/src/emacs" \ + && ps h -o pid -C make | xargs pwdx \ + | grep -q "$HOME/src/emacs" ); then EMACSCLIENT="$HOME/src/emacs/lib-src/emacsclient" else EMACSCLIENT=$(command -v emacsclient) |