2015-03-18 22:49:19 +08:00
|
|
|
function __major_version
|
|
|
|
if test -n "$argv"
|
|
|
|
set -l full_metadata (eval $argv --version)
|
|
|
|
set -l full_version (echo $full_metadata | grep -o "[0-9]\+.[0-9]\+.[0-9]\+.[0-9]\+")
|
|
|
|
set -l major_version (echo $full_version | sed "s/\..*//")
|
|
|
|
end
|
|
|
|
|
|
|
|
echo $major_version
|
|
|
|
end
|
|
|
|
|
|
|
|
function __set_editor
|
2015-04-01 00:27:26 +08:00
|
|
|
if not set -q EDITOR
|
|
|
|
set -gx EDITOR emacs
|
|
|
|
end
|
2015-03-18 22:49:19 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
function __add_functions_to_path
|
|
|
|
set emacs_functions $fish_path/plugins/emacs/functions
|
|
|
|
set fish_function_path $emacs_functions $fish_function_path
|
|
|
|
end
|
|
|
|
|
2015-04-01 00:27:26 +08:00
|
|
|
if not set -q __emacs
|
|
|
|
set __emacs (which emacs)
|
|
|
|
end
|
|
|
|
if not set -q __emacs_version
|
|
|
|
set __emacs_version (__major_version $__emacs)
|
|
|
|
end
|
2015-03-18 22:49:19 +08:00
|
|
|
|
|
|
|
if test "$__emacs_version" -gt 23
|
|
|
|
__set_editor
|
|
|
|
__add_functions_to_path
|
|
|
|
end
|
|
|
|
|
|
|
|
set -e emacs
|
|
|
|
set -e emacs_version
|
|
|
|
functions -e __major_version
|
|
|
|
functions -e __plugins_path
|
|
|
|
functions -e __set_editor
|
|
|
|
functions -e __add_functions_to_path
|