oh-my-fish/plugins/emacs/emacs.load
Kelvin Smith c501d0f2c6 Add emacs plugin (even more updated)
Incorporate changes after code review of #408
2015-04-01 10:23:00 +05:30

40 lines
892 B
Fish

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
if not set -q EDITOR
set -gx EDITOR emacs
end
end
function __add_functions_to_path
set emacs_functions $fish_path/plugins/emacs/functions
set fish_function_path $emacs_functions $fish_function_path
end
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
__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