summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2013-12-07 13:34:57 -0500
committerLuke Shumaker <LukeShu@sbcglobal.net>2013-12-07 13:34:57 -0500
commit09d359f555f883653f745109a5b07a7d44ec8dd5 (patch)
treee64baeffd8075ef07320e3d830c7cff0b9beae22
parent2aeb4cce82448d0216411fb8a0b6676f5e87d7da (diff)
bash/rc.d/emacs.sh: fix indenting
-rw-r--r--.config/bash/rc.d/emacs.sh44
1 files changed, 23 insertions, 21 deletions
diff --git a/.config/bash/rc.d/emacs.sh b/.config/bash/rc.d/emacs.sh
index 7e84651..838c0a4 100644
--- a/.config/bash/rc.d/emacs.sh
+++ b/.config/bash/rc.d/emacs.sh
@@ -1,28 +1,30 @@
+#!/bin/bash
+
case "$TERM" in
eterm*)
- SELECTED_EDITOR='emacsclient'
- EDITOR=$SELECTED_EDITOR
- VISUAL=$SELECTED_EDITOR
- export SELECTED_EDITOR EDITOR VISUAL
- _set_buffer_name() {
- local name="$*"
- local name_esc="${name//\\/\\\\}"
- name_esc="${name_esc//\"/\\\"}"
- emacsclient -e "
+ SELECTED_EDITOR='emacsclient'
+ EDITOR=$SELECTED_EDITOR
+ VISUAL=$SELECTED_EDITOR
+ export SELECTED_EDITOR EDITOR VISUAL
+ _set_buffer_name() {
+ local name="$*"
+ local name_esc="${name//\\/\\\\}"
+ name_esc="${name_esc//\"/\\\"}"
+ emacsclient -e "
(with-current-buffer (window-buffer (selected-window))
(if (not (string= \"${name}\" (buffer-name)))
(rename-buffer (generate-new-buffer-name \"${name}\"))))
" &>/dev/null
- }
- _create_buffer_name() {
- local base=$PWD suffix=''
- if [[ $base =~ /(src|pkg|doc|pkg-libre|src-libre|trunk|tags|branches)$ ]]; then
- suffix=$BASH_REMATCH
- base=${base%$suffix}
- fi
- base=${base##*/}
- echo "*ansi-term*<${base}${suffix}>"
- }
- PROMPT_COMMAND='_set_buffer_name "$(_create_buffer_name)"'
- :;;
+ }
+ _create_buffer_name() {
+ local base=$PWD suffix=''
+ if [[ $base =~ /(src|pkg|doc|pkg-libre|src-libre|trunk|tags|branches)$ ]]; then
+ suffix=$BASH_REMATCH
+ base=${base%$suffix}
+ fi
+ base=${base##*/}
+ echo "*ansi-term*<${base}${suffix}>"
+ }
+ PROMPT_COMMAND='_set_buffer_name "$(_create_buffer_name)"'
+ :;;
esac