mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-11-26 17:53:49 +01:00
- Fix pass of parameters
- Add new function `ecd'.
This commit is contained in:
parent
a183bcbc6d
commit
49c0a1381a
@ -23,8 +23,24 @@ if "$ZSH/tools/require_tool.sh" emacs 23 2>/dev/null ; then
|
|||||||
# to code all night long
|
# to code all night long
|
||||||
alias emasc=emacs
|
alias emasc=emacs
|
||||||
alias emcas=emacs
|
alias emcas=emacs
|
||||||
|
|
||||||
|
# jump to the directory of the current buffer
|
||||||
|
function ecd {
|
||||||
|
local cmd="(let ((buf-name (buffer-file-name (window-buffer))))
|
||||||
|
(if buf-name
|
||||||
|
(file-name-directory buf-name)))"
|
||||||
|
|
||||||
|
local dir=`$EDITOR --eval "$cmd" | tr -d \"`
|
||||||
|
if [ -n "$dir" ] ;then
|
||||||
|
cd "$dir"
|
||||||
|
else
|
||||||
|
echo "can not deduce current buffer filename." >/dev/stderr
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
## Local Variables:
|
## Local Variables:
|
||||||
## mode: sh
|
## mode: sh
|
||||||
## End:
|
## End:
|
||||||
|
@ -4,8 +4,8 @@
|
|||||||
|
|
||||||
x=`emacsclient --alternate-editor '' --eval '(x-display-list)' 2>/dev/null`
|
x=`emacsclient --alternate-editor '' --eval '(x-display-list)' 2>/dev/null`
|
||||||
if [ -z "$x" ] ;then
|
if [ -z "$x" ] ;then
|
||||||
emacsclient --alternate-editor "" --create-frame $@
|
emacsclient --alternate-editor "" --create-frame "$@"
|
||||||
else
|
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 "" "$@"
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user