summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <shumakl@purdue.edu>2015-09-24 16:07:53 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2015-10-04 15:04:42 -0400
commit64423da6f1b192aeb1c96282afc049b69ff8b763 (patch)
tree2de802c8e7511446b80050e2f91cf02a42ad33e3
parent1cdc7055122eae4a260b0f6f5aaa5522af145e43 (diff)
bash emacs integration: only fall back to `hostname -f` if necessary
-rw-r--r--.config/bash/rc.d/90_emacs.sh10
1 files changed, 7 insertions, 3 deletions
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() {