From 64423da6f1b192aeb1c96282afc049b69ff8b763 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Thu, 24 Sep 2015 16:07:53 -0400 Subject: bash emacs integration: only fall back to `hostname -f` if necessary --- .config/bash/rc.d/90_emacs.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to '.config/bash/rc.d/90_emacs.sh') diff --git a/.config/bash/rc.d/90_emacs.sh b/.config/bash/rc.d/90_emacs.sh index 595ddcf..79d5e61 100644 --- a/.config/bash/rc.d/90_emacs.sh +++ b/.config/bash/rc.d/90_emacs.sh @@ -36,12 +36,16 @@ if [[ $TERM == eterm* ]]; then # (default-directory) to an invalid TRAMP string. # # Because the hostname is compared to (system-name) to - # check if it is localhost, "$(hostname -f)" needs to - # be used instead of $HOSTNAME, unfortunately. + # check if it is localhost, "$(hostname -f)" may need + # to be used instead of $HOSTNAME, if + # $HOSTNAME/$(hostname) doesn't return a qualified + # domain. + local hostname=$HOSTNAME + [[ $hostname = *.* ]] || hostname="$(hostname -f)" printf '\eAnSiT%s %s\n' \ u "$USER" \ c "$PWD" \ - h "$(hostname -f)" + h "$hostname" } # Set the shell's X11 display (emacs -> shell) _emacs_set_shell_DISPLAY() { -- cgit v1.2.3-54-g00ecf