diff options
author | Alan Pearce | 2013-10-08 17:07:23 +0100 |
---|---|---|
committer | Alan Pearce | 2013-10-08 17:13:07 +0100 |
commit | 4cac4e8b64f52a05837f1f40af9fba355370d5ee (patch) | |
tree | 9c36658b650f80d3c45bb282ab77ba205c5f63b8 /zsh/zshrc | |
parent | c0633cd67a4a6bfd40cf3eea146cbdc5679916d3 (diff) | |
download | nixfiles-4cac4e8b64f52a05837f1f40af9fba355370d5ee.tar.lz nixfiles-4cac4e8b64f52a05837f1f40af9fba355370d5ee.tar.zst nixfiles-4cac4e8b64f52a05837f1f40af9fba355370d5ee.zip |
Add ec and et commands to launch emacsclient in a terminal and GUI respectively
Diffstat (limited to 'zsh/zshrc')
-rwxr-xr-x | zsh/zshrc | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/zsh/zshrc b/zsh/zshrc index 672ed7ce..6fd0362b 100755 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -310,6 +310,8 @@ alias wprop='xprop |awk '\'' /^WM_NAME/{sub(/.* =/, "title:"); print} /^WM_WINDOW_ROLE/{sub(/.* =/, "role:"); print}'\''' +alias et="emacsclient -t" + alias -g ...='../..' #Suffix aliases @@ -374,6 +376,28 @@ smart_compile () { fi } +emacs_change_focus () { + emacsclient -n -e "(select-frame-set-input-focus (selected-frame))" > /dev/null +} + +ec () { + local visibleFrames + visibleFrames=`emacsclient -e '(length (visible-frame-list))'` + if [[ $? -ne 0 ]]; then + print "Daemon not running" + return 1 + fi + + if [[ $visibleFrames -eq 1 ]]; then + emacsclient -n -c "$@" && emacs_change_focus + else + emacs_change_focus + if [[ $# -gt 0 ]]; then + emacsclient -n "$@" + fi + fi +} + _FASD_DATA="$HOME/.zsh/fasd-data" autoload -U fasd source ~/.zsh/cache/fasd-init-zsh |