summaryrefslogtreecommitdiff
path: root/plugins/emacs
diff options
context:
space:
mode:
authorTristan Carel <tcarel@exalead.com>2011-10-10 18:04:24 +0200
committerTristan Carel <tcarel@exalead.com>2011-10-10 18:04:24 +0200
commita01b1fefe63101fdc36291d0ec2097bdc3994f22 (patch)
tree99dfbb25c78940e2cb6ea36f8601f83e691e5b34 /plugins/emacs
parent3a408f326f1436a81ae481610c76c8938903df4f (diff)
downloadzsh-a01b1fefe63101fdc36291d0ec2097bdc3994f22.tar.gz
zsh-a01b1fefe63101fdc36291d0ec2097bdc3994f22.tar.bz2
zsh-a01b1fefe63101fdc36291d0ec2097bdc3994f22.zip
Do not overwrite EDITOR environment variable if already defined.
Diffstat (limited to 'plugins/emacs')
-rw-r--r--plugins/emacs/emacs.plugin.zsh14
1 files changed, 9 insertions, 5 deletions
diff --git a/plugins/emacs/emacs.plugin.zsh b/plugins/emacs/emacs.plugin.zsh
index e22f10740..a3f0085a8 100644
--- a/plugins/emacs/emacs.plugin.zsh
+++ b/plugins/emacs/emacs.plugin.zsh
@@ -11,12 +11,16 @@
if "$ZSH/tools/require_tool.sh" emacs 23 2>/dev/null ; then
- export EDITOR="$ZSH/plugins/emacs/emacsclient.sh"
- alias emacs="$EDITOR --no-wait"
+ export EMACS_PLUGIN_LAUNCHER="$ZSH/plugins/emacs/emacsclient.sh"
+
+ # set EDITOR if not already defined.
+ export EDITOR="${EDITOR:-${EMACS_PLUGIN_LAUNCHER}}"
+
+ alias emacs="$EMACS_PLUGIN_LAUNCHER --no-wait"
alias e=emacs
# same than M-x eval but from outside Emacs.
- alias eeval="$EDITOR --eval"
+ alias eeval="$EMACS_PLUGIN_LAUNCHER --eval"
# create a new X frame
alias eframe='emacsclient --alternate-editor "" --create-frame'
@@ -28,7 +32,7 @@ if "$ZSH/tools/require_tool.sh" emacs 23 2>/dev/null ; then
# opened in the current buffer.
function efile {
local cmd="(buffer-file-name (window-buffer))"
- $EDITOR --eval "$cmd" | tr -d \"
+ "$EMACS_PLUGIN_LAUNCHER" --eval "$cmd" | tr -d \"
}
# Write to standard output the directory of the file
@@ -37,7 +41,7 @@ if "$ZSH/tools/require_tool.sh" emacs 23 2>/dev/null ; then
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 \")"
+ local dir="$($EMACS_PLUGIN_LAUNCHER --eval $cmd | tr -d \")"
if [ -n "$dir" ] ;then
echo "$dir"
else