diff options
author | Luke Shumaker <LukeShu@sbcglobal.net> | 2014-04-26 13:56:43 -0400 |
---|---|---|
committer | Luke Shumaker <LukeShu@sbcglobal.net> | 2014-04-26 13:56:43 -0400 |
commit | a0b0e2faf634625c2ae1981cb1a5604648ad8334 (patch) | |
tree | f288acabdb8849a46e333536a71004d39ac2ba34 | |
parent | e93048c125c728d61613d76eab938da9bf7f41c4 (diff) | |
parent | f6742e8302f615b75eb6a2dd4faf3b306be56012 (diff) |
Merge remote-tracking branch 'origin/master' into build64-par
Conflicts:
.config/wmii-hg/autostart
-rw-r--r-- | .config/bash/aliases.sh | 1 | ||||
-rw-r--r-- | .config/bash/rc.d/emacs.sh | 135 | ||||
-rw-r--r-- | .config/login.sh | 13 | ||||
-rw-r--r-- | .config/ssh/config | 2 | ||||
-rw-r--r-- | .config/systemd/user/default.target.wants/gpg-agent.service | 2 | ||||
-rwxr-xr-x | .config/wmii-hg/autostart | 3 |
6 files changed, 106 insertions, 50 deletions
diff --git a/.config/bash/aliases.sh b/.config/bash/aliases.sh index aabd073..c9a1987 100644 --- a/.config/bash/aliases.sh +++ b/.config/bash/aliases.sh @@ -40,6 +40,7 @@ alias l='ls -CF' alias tree='tree --charset utf8' alias cd=pushd alias gitk='gitk --all --date-order' +alias userctl='systemctl --user' ###################################################################### # Remember lat/long for redshift # diff --git a/.config/bash/rc.d/emacs.sh b/.config/bash/rc.d/emacs.sh index 9c1bf4d..165d71e 100644 --- a/.config/bash/rc.d/emacs.sh +++ b/.config/bash/rc.d/emacs.sh @@ -1,41 +1,98 @@ #!/bin/bash -case "$TERM" in - eterm*) - SELECTED_EDITOR='emacsclient' - EDITOR=$SELECTED_EDITOR - VISUAL=$SELECTED_EDITOR - export SELECTED_EDITOR EDITOR VISUAL - # The following uses the variable _EMACS_BUFFER to store some state - _emacs_quote() { - local str="$*" - str="${str//\\/\\\\}" - str="${str//\"/\\\"}" - str="\"${str}\"" - printf '%s' "$str" - } - _emacs_rename_terminal() { - local name="$(_emacs_quote "$(_emacs_get_desired_buffer_name)")" - if [[ -n $_EMACS_BUFFER ]]; then - local buffer="(get-buffer $_EMACS_BUFFER)" - else - local buffer='(window-buffer (selected-window))' - fi - _EMACS_BUFFER="$(emacsclient -e "(with-current-buffer ${buffer} (rename-buffer ${name} t)))" 2>/dev/null)" - } - _emacs_get_short_cwd() { - local base=$1 - local suffix='' - if [[ $base =~ (/(src|pkg|doc|pkg-libre|src-libre|trunk|tags|branches))*$ ]]; then - suffix=$BASH_REMATCH - base=${base%$suffix} - fi - base=${base##*/} - echo ${base}${suffix} - } - _emacs_get_desired_buffer_name() { - echo "*ansi-term*<$(_emacs_get_short_cwd "$PWD")>" - } - PROMPT_COMMAND='_emacs_rename_terminal "$(_emacs_get_desired_buffer_name)"' - :;; -esac +if [[ $TERM == eterm* ]]; then + SELECTED_EDITOR='emacsclient' + EDITOR=$SELECTED_EDITOR + VISUAL=$SELECTED_EDITOR + export SELECTED_EDITOR EDITOR VISUAL + + ## Primatives for interacting with Emacs ############################### + + # _emacs_run LISP + _emacs_run() { + emacsclient -e "$*" 2>/dev/null + } + # _emacs_quote UNQUOTED_STRING + _emacs_quote() { + local str="$*" + str="${str//\\/\\\\}" # \ -> \\ + str="${str//\"/\\\"}" # " -> \" + str="\"${str}\"" # wrap it in quotes + printf '%s' "$str" + } + # _emacs_unquote QUOTED_STRING + _emacs_unquote() { + + local str="$*" + if [[ $str =~ ^\"(.*)\"$ ]]; then + str=${BASH_REMATCH[1]} # un-quote it + str="${str//\\\\/\\}" # \\ -> \ + str="${str//\\\"/\"}" # \" -> " + fi + printf '%s' "$str" + } + + ## Deal with renaming the terminal ##################################### + + # _emacs_rename_terminal NEW_BUFFER_NAME + # This function uses the variable _EMACS_BUFFER to store some state + _emacs_rename_terminal() { + local name=$(_emacs_quote "$*") + if [[ -n $_EMACS_BUFFER ]]; then + local buffer="(get-buffer $_EMACS_BUFFER)" + else + local buffer='(window-buffer (selected-window))' + fi + _EMACS_BUFFER=$(_emacs_run "(with-current-buffer ${buffer} (rename-buffer ${name} t))") + } + # _emacs_get_short_cwd + _emacs_get_short_cwd() { + local base=$PWD + local suffix='' + # The regex here is a list of directory names + # that aren't really helpful, and that the + # parent directory should be included also. + if [[ $base =~ (/(src|pkg|doc|pkg-libre|src-libre|trunk|tags|branches))*$ ]]; then + suffix=$BASH_REMATCH + base=${base%$suffix} + fi + base=${base##*/} + echo ${base}${suffix} + } + # _emacs_get_desired_buffer_name + _emacs_get_desired_buffer_name() { + echo "*ansi-term*<$(_emacs_get_short_cwd)>" + } + + ## High-level tasks #################################################### + + # Like uniquify on the buffer name (shell -> emacs) + _emacs_set_buffer_name() { + # This doesn't work correctly on remote hosts. + # The "correct" solution is probably to hook into + # default-directory being set in term.el + _emacs_rename_terminal "$(_emacs_get_desired_buffer_name)" + } + # Set the TRAMP directory for remote hosts (shell -> emacs) + _emacs_set_remote_dir() { + if [[ -n $SSH_CONNECTION ]]; then + printf '\eAnSiT%s %s\n' \ + u "$USER" \ + c "$PWD" \ + h "$HOSTNAME" + fi + } + # Set the shell's X11 display (emacs -> shell) + _emacs_set_shell_DISPLAY() { + export DISPLAY=$(_emacs_unquote "$(_emacs_run "(cdr (assoc 'display (frame-parameters)))")") + } + + ## Do those things ##################################################### + + _emacs_PROMPT_COMMAND() { + _emacs_set_buffer_name + _emacs_set_remote_dir + _emacs_set_shell_DISPLAY + } + PROMPT_COMMAND=_emacs_PROMPT_COMMAND +fi diff --git a/.config/login.sh b/.config/login.sh index 3c29c99..e1650b2 100644 --- a/.config/login.sh +++ b/.config/login.sh @@ -28,8 +28,7 @@ export TMPDIR="$HOME/tmp" # XDG ################################################################ . "$HOME/.local/lib/xdg.sh" -mkdir -p -- "$XDG_RUNTIME_DIR/sessions" -ln -sfT -- "$XDG_RUNTIME_DIR/sessions" ~/.sessions +ln -sfT -- "$XDG_RUNTIME_DIR" ~/.runtime # Settings ########################################################### @@ -52,10 +51,10 @@ if [[ -z $GPGKEY ]] && [[ -f "${HOME}/.gnupg/gpg.conf" ]]; then echo 'login: Setting GPGKEY' export GPGKEY=`sed -nr 's/^\s*default-key\s+//p' "${HOME}/.gnupg/gpg.conf"` fi -if [[ -f ~/.sessions/gpg ]]; then +if [[ -f ~/.runtime/gpg ]]; then echo 'login: Setting gpg-agent info:' - cat ~/.sessions/gpg - . ~/.sessions/gpg + cat ~/.runtime/gpg + . ~/.runtime/gpg export GPG_AGENT_INFO #export SSH_AUTH_SOCK fi @@ -72,8 +71,8 @@ export _JAVA_OPTIONS # X11 if [[ -z $XAUTHORITY ]]; then - #export XAUTHORITY="$HOME/.Xauthority" - export XAUTHORITY=$HOME/.sessions/Xauthority + export XAUTHORITY="$HOME/.Xauthority" + #export XAUTHORITY=$HOME/.runtime/Xauthority fi # D-Bus diff --git a/.config/ssh/config b/.config/ssh/config index b6e53d6..9b366ed 100644 --- a/.config/ssh/config +++ b/.config/ssh/config @@ -1,7 +1,7 @@ Host * Protocol 2 ControlMaster auto - ControlPath ~/.sessions/ssh-%r@%h:%p + ControlPath ~/.runtime/ssh-%r@%h:%p Compression yes Host lore diff --git a/.config/systemd/user/default.target.wants/gpg-agent.service b/.config/systemd/user/default.target.wants/gpg-agent.service index a9de9b2..93c12b0 100644 --- a/.config/systemd/user/default.target.wants/gpg-agent.service +++ b/.config/systemd/user/default.target.wants/gpg-agent.service @@ -3,7 +3,7 @@ Description="GnuPG agent daemon" [Service] Type=forking -ExecStart=/usr/bin/gpg-agent --daemon --write-env-file ${HOME}/.sessions/gpg +ExecStart=/usr/bin/gpg-agent --daemon --write-env-file ${XDG_RUNTIME_DIR}/gpg [Install] WantedBy=default.target diff --git a/.config/wmii-hg/autostart b/.config/wmii-hg/autostart index ed37f33..f5e5419 100755 --- a/.config/wmii-hg/autostart +++ b/.config/wmii-hg/autostart @@ -6,8 +6,7 @@ daemon lxpanel &> /dev/null #daemon nm-applet &> /dev/null daemon dunst &> /dev/null daemon blueman-applet &> /dev/null -#daemon linphone --iconified &> /dev/null -dameon clipit -dn &> /dev/null +dameon clipit -dn &> /dev/null Action rbar_cpu 01 & Action rbar_clock 99 & |