X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;ds=sidebyside;f=switch-mail-host;h=f1cb21272e6a057b41d5e49554b765fc1e98af90;hb=0f9a999aa601cd77343a3e08cf0c6c4f9f943813;hp=b31ab793951f6807879e37eb1dcfd7beaf5ed39c;hpb=51c8b40fd2aac71d29dc9298ca65425725ad1edd;p=distro-setup diff --git a/switch-mail-host b/switch-mail-host index b31ab79..f1cb212 100644 --- a/switch-mail-host +++ b/switch-mail-host @@ -1,6 +1,6 @@ #!/bin/bash -source /usr/local/lib/bash-bear +set -e; . /usr/local/lib/bash-bear; set +e usage() { cat </dev/null; then - bufs="$(sudo -u iank env XDG_RUNTIME_DIR=/run/user/1000 emacsclient --eval "$(cat /a/bin/ds/unsaved-buffers.el)"| sed '/^"nil"$/d;s/^"(/E: /;s/)"$//')" - if [[ $bufs ]]; then - echo "error: on $HOSTNAME, unsaved emacs files: $bufs" >&2 - exit 1 - fi -fi -EOF + cat /usr/local/bin/unsaved-buffers if ! $host2_only; then cat </dev/null; then - bufs="$(sudo -u iank env XDG_RUNTIME_DIR=/run/user/1000 emacsclient --eval "$(cat /a/bin/ds/unsaved-buffers.el)"| sed '/^"nil"$/d;s/^"(/E: /;s/)"$//')" - if [[ $bufs ]]; then - echo "error: on $HOSTNAME, unsaved emacs files: $bufs" >&2 - exit 1 - fi -fi + cat /usr/local/bin/unsaved-buffers - <<'EOF' | $old_shell bash -s # Try to prevent emacs from saving stale data it has in memory to disk. eg: files, recentf list, etc. # But if emacs ignores the signal, let it live.