diff --git a/plugins/emacs/emacs.load b/plugins/emacs/emacs.load index bdfc300..41417ff 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 52e839e..1f23753 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 4fcde6a..b0b8978 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