summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/emacsclient13
1 files changed, 8 insertions, 5 deletions
diff --git a/bin/emacsclient b/bin/emacsclient
index 4bbf097c..16aca4ae 100755
--- a/bin/emacsclient
+++ b/bin/emacsclient
@@ -66,13 +66,16 @@ maybe_notify () {
&& notify-send --urgency=low --expire-time=10000 "$1"
}
+fail () {
+ # emacsclient(1) exits with this exit code on all failures.
+ maybe_notify "$1"; exit 1
+}
+
spw_flock () {
( umask 077; mkdir -p "$locks_dir" )
eval "exec $1<>${locks_dir}$2"
- if ! flock --wait 15 "$1"; then
- maybe_notify "couldn't lock starting Emacs daemon named $2"
- exit 1
- fi
+ flock --wait 15 "$1" \
+ || fail "couldn't lock starting Emacs daemon named $2"
}
pass_to_gdbmacs () {
@@ -130,7 +133,7 @@ if [ -n "$listener" ]; then
case "$(ps h -o exe $listener | sed -e 's/ (deleted)$//')" in
"$devel_emacs") devel_running=true ;;
"$(realpath $installed_emacs)") installed_running=true ;;
- *) echo >&2 "Unknown Emacs listening on $socket"; exit 1 ;;
+ *) fail "Unknown Emacs listening on $socket" ;;
esac
fi