mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-11-22 05:40:08 +00:00
Add new plugin emacs, to take benefit of daemon capabilities of emacs >=23
This commit is contained in:
parent
bbf1f87ee6
commit
2fba4486bf
2 changed files with 21 additions and 0 deletions
11
plugins/emacs/emacs.plugin.zsh
Normal file
11
plugins/emacs/emacs.plugin.zsh
Normal file
|
@ -0,0 +1,11 @@
|
|||
# Use daemon capabilities of emacs 23
|
||||
if "$ZSH/tools/require_tool.sh" emacs 23 2>/dev/null ; then
|
||||
export EDITOR="$ZSH/plugins/emacs/emacsclient.sh"
|
||||
alias emacs="$EDITOR --no-wait"
|
||||
alias e=emacs
|
||||
|
||||
alias emasc=emacs
|
||||
alias emcas=emacs
|
||||
# create a new X frame
|
||||
alias emacs_frame='emacsclient --alternate-editor "" --create-frame'
|
||||
fi
|
10
plugins/emacs/emacsclient.sh
Executable file
10
plugins/emacs/emacsclient.sh
Executable file
|
@ -0,0 +1,10 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Starts emacs daemon if not already started.
|
||||
|
||||
x=`emacsclient --alternate-editor '' --eval '(x-display-list)' 2>/dev/null`
|
||||
if [ -z "$x" ] ;then
|
||||
emacsclient --alternate-editor "" --create-frame $@
|
||||
else
|
||||
emacsclient --alternate-editor "" $@
|
||||
fi
|
Loading…
Reference in a new issue