diff --git a/plugins/emacs/emacs.load b/plugins/emacs/emacs.load index bdfc300076c5b67f9897a69edb4148aa1187fb83..41417ffba74686067ce3ec2dad7ad144c93e67fd 100644 --- a/plugins/emacs/emacs.load +++ b/plugins/emacs/emacs.load @@ -9,7 +9,9 @@ function __major_version end function __set_editor - set -q EDITOR; or set -gx EDITOR emacs + if not set -q EDITOR + set -gx EDITOR emacs + end end function __add_functions_to_path @@ -17,8 +19,12 @@ function __add_functions_to_path set fish_function_path $emacs_functions $fish_function_path end -set -q __emacs; or set __emacs (which emacs) -set -q __emacs_version; or set __emacs_version (__major_version $__emacs) +if not set -q __emacs + set __emacs (which emacs) +end +if not set -q __emacs_version + set __emacs_version (__major_version $__emacs) +end if test "$__emacs_version" -gt 23 __set_editor diff --git a/plugins/emacs/functions/__launch_emacs.fish b/plugins/emacs/functions/__launch_emacs.fish index 52e839eb237fb56efccf2fc509956422dbecaa87..1f23753437e3ccbe2243321969b16e9d2799e143 100644 --- a/plugins/emacs/functions/__launch_emacs.fish +++ b/plugins/emacs/functions/__launch_emacs.fish @@ -1,9 +1,9 @@ function __launch_emacs set -l x (emacsclient --alternate-editor '' --eval '(x-display-list)' 2>/dev/null) - if begin; test -z "$x"; or test $x = nil; end + if test -z "$x" -o "$x" = nil emacsclient $argv --alternate-editor '' --create-frame else - or emacsclient $argv --alternate-editor '' + emacsclient $argv --alternate-editor '' end end diff --git a/plugins/emacs/functions/ecd.fish b/plugins/emacs/functions/ecd.fish index 4fcde6aee19eb889b8343643476ffe4b5ae1f5ec..b0b8978b46adb57d93da0eb12e79550ddea02adc 100644 --- a/plugins/emacs/functions/ecd.fish +++ b/plugins/emacs/functions/ecd.fish @@ -7,6 +7,5 @@ function ecd echo $dir else echo 'cannot deduce current buffer filename.' >/dev/stderr - return 1 end end