mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-12-27 15:30:15 +08:00
Update emacs plugin. (#5201)
- Updated minimal version from 23 to 24. - Added new aliases that fix unexpected close with -nw option. - Removed some old aliases. - Fixed line that detects open frames.
This commit is contained in:
parent
d0610931db
commit
eb244d9ec0
@ -10,7 +10,7 @@
|
|||||||
# - Configuration changes made at runtime are applied to all frames.
|
# - Configuration changes made at runtime are applied to all frames.
|
||||||
|
|
||||||
|
|
||||||
if "$ZSH/tools/require_tool.sh" emacs 23 2>/dev/null ; then
|
if "$ZSH/tools/require_tool.sh" emacs 24 2>/dev/null ; then
|
||||||
export EMACS_PLUGIN_LAUNCHER="$ZSH/plugins/emacs/emacsclient.sh"
|
export EMACS_PLUGIN_LAUNCHER="$ZSH/plugins/emacs/emacsclient.sh"
|
||||||
|
|
||||||
# set EDITOR if not already defined.
|
# set EDITOR if not already defined.
|
||||||
@ -18,15 +18,14 @@ if "$ZSH/tools/require_tool.sh" emacs 23 2>/dev/null ; then
|
|||||||
|
|
||||||
alias emacs="$EMACS_PLUGIN_LAUNCHER --no-wait"
|
alias emacs="$EMACS_PLUGIN_LAUNCHER --no-wait"
|
||||||
alias e=emacs
|
alias e=emacs
|
||||||
|
# open terminal emacsclient
|
||||||
|
alias te="$EMACS_PLUGIN_LAUNCHER -nw"
|
||||||
|
|
||||||
# same than M-x eval but from outside Emacs.
|
# same than M-x eval but from outside Emacs.
|
||||||
alias eeval="$EMACS_PLUGIN_LAUNCHER --eval"
|
alias eeval="$EMACS_PLUGIN_LAUNCHER --eval"
|
||||||
# create a new X frame
|
# create a new X frame
|
||||||
alias eframe='emacsclient --alternate-editor "" --create-frame'
|
alias eframe='emacsclient --alternate-editor "" --create-frame'
|
||||||
|
|
||||||
# to code all night long
|
|
||||||
alias emasc=emacs
|
|
||||||
alias emcas=emacs
|
|
||||||
|
|
||||||
# Write to standard output the path to the file
|
# Write to standard output the path to the file
|
||||||
# opened in the current buffer.
|
# opened in the current buffer.
|
||||||
|
@ -2,15 +2,15 @@
|
|||||||
|
|
||||||
_emacsfun()
|
_emacsfun()
|
||||||
{
|
{
|
||||||
# get list of available X windows.
|
# get list of emacs frames.
|
||||||
x=`emacsclient --alternate-editor '' --eval '(x-display-list)' 2>/dev/null`
|
frameslist=`emacsclient --alternate-editor '' --eval '(frame-list)' 2>/dev/null | egrep -o '(frame)+'`
|
||||||
|
|
||||||
if [ -z "$x" ] || [ "$x" = "nil" ] ;then
|
if [ "$(echo "$frameslist" | sed -n '$=')" -ge 2 ] ;then
|
||||||
# Create one if there is no X window yet.
|
|
||||||
emacsclient --alternate-editor "" --create-frame "$@"
|
|
||||||
else
|
|
||||||
# prevent creating another X frame if there is at least one present.
|
# prevent creating another X frame if there is at least one present.
|
||||||
emacsclient --alternate-editor "" "$@"
|
emacsclient --alternate-editor "" "$@"
|
||||||
|
else
|
||||||
|
# Create one if there is no X window yet.
|
||||||
|
emacsclient --alternate-editor "" --create-frame "$@"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user