Commit c501d0f2 authored by Kelvin Smith's avatar Kelvin Smith

Add emacs plugin (even more updated)

Incorporate changes after code review of #408
parent 55a2e6d0
...@@ -9,7 +9,9 @@ function __major_version ...@@ -9,7 +9,9 @@ function __major_version
end end
function __set_editor function __set_editor
set -q EDITOR; or set -gx EDITOR emacs if not set -q EDITOR
set -gx EDITOR emacs
end
end end
function __add_functions_to_path function __add_functions_to_path
...@@ -17,8 +19,12 @@ function __add_functions_to_path ...@@ -17,8 +19,12 @@ function __add_functions_to_path
set fish_function_path $emacs_functions $fish_function_path set fish_function_path $emacs_functions $fish_function_path
end end
set -q __emacs; or set __emacs (which emacs) if not set -q __emacs
set -q __emacs_version; or set __emacs_version (__major_version $__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 if test "$__emacs_version" -gt 23
__set_editor __set_editor
......
function __launch_emacs function __launch_emacs
set -l x (emacsclient --alternate-editor '' --eval '(x-display-list)' 2>/dev/null) 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 emacsclient $argv --alternate-editor '' --create-frame
else else
or emacsclient $argv --alternate-editor '' emacsclient $argv --alternate-editor ''
end end
end end
...@@ -7,6 +7,5 @@ function ecd ...@@ -7,6 +7,5 @@ function ecd
echo $dir echo $dir
else else
echo 'cannot deduce current buffer filename.' >/dev/stderr echo 'cannot deduce current buffer filename.' >/dev/stderr
return 1
end end
end end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment