diff options
Diffstat (limited to 'bin/emacsclient')
-rwxr-xr-x | bin/emacsclient | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/bin/emacsclient b/bin/emacsclient index 752102f9..f14c6c63 100755 --- a/bin/emacsclient +++ b/bin/emacsclient @@ -34,9 +34,6 @@ gud_status= daemon_name= gdbmacs= args= -xdg="${XDG_RUNTIME_DIR:-/run/user/$(id -u)}" -socket_dir="$xdg/emacs/" -locks_dir="$xdg/spw_emacsclient/" get_listener () { local socket="$1" @@ -52,8 +49,7 @@ get_listener () { maybe_notify () { echo >&2 "$1" - [ -n "$XDG_RUNTIME_DIR" ] \ - && notify-send --urgency=low --expire-time=10000 "$1" + $was_set && notify-send --urgency=low --expire-time=10000 "$1" } spw_flock () { @@ -111,6 +107,17 @@ installed_emacsclient=$(PATH=$(echo "$PATH" \ command -v ss >/dev/null || exec "$installed_emacsclient" -a "" "$@" +# We set and export XDG_RUNTIME_DIR such that Emacs doesn't choose +# "/tmp/emacs$(id -u)" as the socket dir. +if [ -n "$XDG_RUNTIME_DIR" ]; then + was_set=true +else + was_set=false + export XDG_RUNTIME_DIR=/run/user/$(id -u) +fi +socket_dir="$XDG_RUNTIME_DIR/emacs/" +locks_dir="$XDG_RUNTIME_DIR/spw_emacsclient/" + $want_version || spw_flock 3 "${daemon_name:-server}" socket="$socket_dir${daemon_name:-server}" |