summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <shumakl@purdue.edu>2015-09-24 16:07:53 -0400
committerLuke Shumaker <shumakl@purdue.edu>2015-09-24 16:07:53 -0400
commit2de60d8a7af19aaec44cdff2e30bfa6820603a44 (patch)
tree21a00c58f21deeee99901bb9af1b19626c39648c
parent1f657262cae273a20c104465697aa283ed77196b (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() {