diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2021-12-29 16:17:49 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2021-12-29 16:23:50 -0700 |
commit | 838461cc6f17a3249dc404be2d8d6a41cbcf7a0d (patch) | |
tree | 683d53496134895166e3ea2bf6aa352ad3d4c89b /scripts | |
parent | 345c5f1c825e38a3f0dc79e435d1d1ba48f64684 (diff) | |
download | dotfiles-838461cc6f17a3249dc404be2d8d6a41cbcf7a0d.tar.gz |
emacsclient wrapper: more checks to avoid inconsistent situations
Diffstat (limited to 'scripts')
-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) |