Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:21
vimerl
vimerl-1.4.3-git.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File vimerl-1.4.3-git.patch of Package vimerl
diff --git a/autoload/erlang_complete.erl b/autoload/erlang_complete.erl index cb5bae8..23f4efd 100755 --- a/autoload/erlang_complete.erl +++ b/autoload/erlang_complete.erl @@ -113,10 +113,11 @@ simplify_return({typevar, [{name, Name}], _}) -> Name; simplify_return({type, _, [Type]}) -> simplify_return(Type); -simplify_return({abstype, _, [Type]}) -> +simplify_return({abstype, _, [Type | AbsTypes]}) -> {erlangName, Attrs, _} = Type, Name = proplists:get_value(name, Attrs), - Name ++ "()"; + Elems = lists:map(fun(T) -> simplify_return(T) end, AbsTypes), + Name ++ "(" ++ string:join(Elems, ", ") ++ ")"; simplify_return({record, _, [Type]}) -> simplify_return(Type) ++ "()"; simplify_return({nonempty_list, _, [Type]}) -> diff --git a/compiler/erlang.vim b/compiler/erlang.vim index bbd9c21..2202e50 100644 --- a/compiler/erlang.vim +++ b/compiler/erlang.vim @@ -3,7 +3,7 @@ " Author: Pawel 'kTT' Salata <rockplayer.pl@gmail.com> " Contributors: Ricardo Catalinas Jiménez <jimenezrick@gmail.com> " License: Vim license -" Version: 2012/02/08 +" Version: 2013/03/06 if exists("current_compiler") || v:version < 703 finish @@ -48,8 +48,10 @@ function s:ShowErrors() execute "setlocal makeprg=" . s:erlang_check_file . "\\ \%" endif silent make! - call s:ClearErrors() for error in getqflist() + if error.lnum == 0 + continue + endif let item = {} let item["lnum"] = error.lnum let item["text"] = error.text @@ -88,18 +90,22 @@ endfunction function s:EnableShowErrors() if !s:autocmds_defined - autocmd BufWritePost *.erl call s:ShowErrors() - autocmd CursorHold *.erl call s:ShowErrorMsg() - autocmd CursorMoved *.erl call s:ShowErrorMsg() + augroup vimerl + autocmd! + autocmd BufWritePre *.erl call s:ClearErrors() + autocmd BufWritePost *.erl call s:ShowErrors() + autocmd CursorHold *.erl call s:ShowErrorMsg() + autocmd CursorMoved *.erl call s:ShowErrorMsg() + augroup END let s:autocmds_defined = 1 endif endfunction function s:DisableShowErrors() sign unplace * - autocmd! BufWritePost *.erl - autocmd! CursorHold *.erl - autocmd! CursorMoved *.erl + augroup vimerl + autocmd! + augroup END let s:autocmds_defined = 0 endfunction diff --git a/compiler/erlang_check.erl b/compiler/erlang_check.erl index a65c387..de733a5 100755 --- a/compiler/erlang_check.erl +++ b/compiler/erlang_check.erl @@ -1,7 +1,7 @@ #!/usr/bin/env escript main([File]) -> - Dir = filename:dirname(File), + Dir = get_root(filename:dirname(File)), Defs = [strong_validation, warn_export_all, warn_export_vars, @@ -9,12 +9,9 @@ main([File]) -> warn_obsolete_guard, warn_unused_import, report, - {i, Dir ++ "/include"}, - {i, Dir ++ "/../include"}, - {i, Dir ++ "/../../include"}, - {i, Dir ++ "/../../../include"}], + {i, Dir ++ "/include"}], RebarFile = rebar_file(Dir), - RebarOpts = rebar_opts(RebarFile), + RebarOpts = rebar_opts(Dir ++ "/" ++ RebarFile), code:add_patha(filename:absname("ebin")), compile:file(File, Defs ++ RebarOpts); main(_) -> @@ -31,6 +28,7 @@ rebar_file(Dir) -> end. rebar_opts(RebarFile) -> + Dir = get_root(filename:dirname(RebarFile)), case file:consult(RebarFile) of {ok, Terms} -> RebarLibDirs = proplists:get_value(lib_dirs, Terms, []), @@ -40,9 +38,23 @@ rebar_opts(RebarFile) -> end, RebarLibDirs), RebarDepsDir = proplists:get_value(deps_dir, Terms, "deps"), code:add_pathsa(filelib:wildcard(RebarDepsDir ++ "/*/ebin")), - proplists:get_value(erl_opts, Terms, []); + IncludeDeps = {i, filename:join(Dir, RebarDepsDir)}, + proplists:get_value(erl_opts, Terms, []) ++ [IncludeDeps]; {error, _} when RebarFile == "rebar.config" -> []; {error, _} -> rebar_opts("rebar.config") end. + +get_root(Dir) -> + Path = filename:split(filename:absname(Dir)), + filename:join(get_root(lists:reverse(Path), Path)). + +get_root([], Path) -> + Path; +get_root(["src" | Tail], _Path) -> + lists:reverse(Tail); +get_root(["test" | Tail], _Path) -> + lists:reverse(Tail); +get_root([_ | Tail], Path) -> + get_root(Tail, Path). diff --git a/doc/vimerl.txt b/doc/vimerl.txt index cdc5fbf..2ca7b26 100644 --- a/doc/vimerl.txt +++ b/doc/vimerl.txt @@ -244,6 +244,14 @@ process (default: 1, values: 0 or 1): > Note: it could be useful to disable this cache in order to get always fresh info whenever a module is recompiled. +------------------------------------------------------------------------------ + *'erlang_force_use_vimerl_indent'* + +Vim 7.4 comes with an Erlang indent script, thus Vimerl tries to use it when +available. This option forces to use the Vimerl indent script always +(default: 0, values: 0 or 1): > + :let erlang_force_use_vimerl_indent = 0 + ============================================================================== 5. License *vimerl-license* diff --git a/ftdetect/erlang.vim b/ftdetect/erlang.vim new file mode 100644 index 0000000..70db656 --- /dev/null +++ b/ftdetect/erlang.vim @@ -0,0 +1 @@ +autocmd BufNewFile,BufRead *.erl,*.hrl,rebar.config,*.app,*.app.src,*.yaws,*.xrl setfiletype erlang diff --git a/ftplugin/erlang.vim b/ftplugin/erlang.vim index 49b64eb..8faa6ba 100644 --- a/ftplugin/erlang.vim +++ b/ftplugin/erlang.vim @@ -31,6 +31,13 @@ let s:erlang_fun_begin = '^\(\a\w*\|[''][^'']*['']\)(.*$' let s:erlang_fun_end = '^[^%]*\.\s*\(%.*\)\?$' function s:SetErlangOptions() + if executable('erl') != 1 + echohl ErrorMsg + echomsg 'vimerl: erl command not installed' + echohl None + return + endif + compiler erlang if version >= 700 setlocal omnifunc=erlang_complete#Complete diff --git a/indent/erlang.vim b/indent/erlang.vim index 2fcb879..370a881 100644 --- a/indent/erlang.vim +++ b/indent/erlang.vim @@ -2,9 +2,13 @@ " Language: Erlang " Author: Ricardo Catalinas Jiménez <jimenezrick@gmail.com> " License: Vim license -" Version: 2012/11/26 +" Version: 2013/09/11 -if exists('b:did_indent') +if !exists('g:erlang_force_use_vimerl_indent') + let g:erlang_force_use_vimerl_indent = 0 +endif + +if exists('b:did_indent') || (v:version >= 704 && !g:erlang_force_use_vimerl_indent) finish else let b:did_indent = 1 diff --git a/indent/erlang_indent.erl b/indent/erlang_indent.erl index 1beb5af..77b2f5e 100755 --- a/indent/erlang_indent.erl +++ b/indent/erlang_indent.erl @@ -158,9 +158,16 @@ parse_tokens(Tokens = [{'-', _} | _]) -> parse_attribute(Tokens, #state{}); parse_tokens(Tokens = [{atom, _, _} | _]) -> parse_function(Tokens, #state{}); +parse_tokens(Tokens = [{T, _} | _]) when T == '['; T == '{'; T == '(' -> + parse_datum(Tokens, #state{}); parse_tokens(Tokens) -> throw({parse_error, Tokens, #state{}, ?LINE}). +parse_datum([T | Tokens], State) -> + parse_next(Tokens, indent(push(State, T, 0), 1)); +parse_datum([], State) -> + State. + parse_attribute([T = {'-', _}, {atom, _, export} | Tokens], State = #state{stack = []}) -> parse_next(Tokens, push(State, T, -1)); parse_attribute([T1 = {'-', _}, T2, T3 | Tokens], State = #state{stack = []}) when ?IS(T2, atom), ?IS(T3, atom) -> diff --git a/plugin/erlang_skels/common_test b/plugin/erlang_skels/common_test index da2913c..38b58e4 100644 --- a/plugin/erlang_skels/common_test +++ b/plugin/erlang_skels/common_test @@ -1,6 +1,6 @@ -module($MODULENAME). -%% API +%% Common Test callbacks -export([all/0, suite/0, groups/0, diff --git a/plugin/erlang_skels/gen_event b/plugin/erlang_skels/gen_event index d0a678d..078ad9b 100644 --- a/plugin/erlang_skels/gen_event +++ b/plugin/erlang_skels/gen_event @@ -2,7 +2,7 @@ -behaviour(gen_event). -%% API +%% API functions -export([start_link/0, add_handler/2]). @@ -17,7 +17,7 @@ -record(state, {}). %%%=================================================================== -%%% gen_event callbacks +%%% API functions %%%=================================================================== %%-------------------------------------------------------------------- diff --git a/plugin/erlang_skels/gen_fsm b/plugin/erlang_skels/gen_fsm index c4edab4..f82c97a 100644 --- a/plugin/erlang_skels/gen_fsm +++ b/plugin/erlang_skels/gen_fsm @@ -2,7 +2,7 @@ -behaviour(gen_fsm). -%% API +%% API functions -export([start_link/0]). %% gen_fsm callbacks @@ -18,7 +18,7 @@ -record(state, {}). %%%=================================================================== -%%% API +%%% API functions %%%=================================================================== %%-------------------------------------------------------------------- diff --git a/plugin/erlang_skels/gen_server b/plugin/erlang_skels/gen_server index a625b24..00e884c 100644 --- a/plugin/erlang_skels/gen_server +++ b/plugin/erlang_skels/gen_server @@ -2,7 +2,7 @@ -behaviour(gen_server). -%% API +%% API functions -export([start_link/0]). %% gen_server callbacks @@ -16,7 +16,7 @@ -record(state, {}). %%%=================================================================== -%%% API +%%% API functions %%%=================================================================== %%-------------------------------------------------------------------- diff --git a/plugin/erlang_skels/supervisor b/plugin/erlang_skels/supervisor index ce765d0..56552e8 100644 --- a/plugin/erlang_skels/supervisor +++ b/plugin/erlang_skels/supervisor @@ -2,7 +2,7 @@ -behaviour(supervisor). -%% API +%% API functions -export([start_link/0]). %% Supervisor callbacks diff --git a/syntax/erlang.vim b/syntax/erlang.vim index 642f1f4..4a12295 100644 --- a/syntax/erlang.vim +++ b/syntax/erlang.vim @@ -32,7 +32,7 @@ syn match erlangAnnotation /\%(%\s\)\@<=@\%(author\|clear\|cop syn match erlangAnnotation /`[^']\+'/ contained syn keyword erlangKeyword band bor bnot bsl bsr bxor div rem xor -syn keyword erlangKeyword try catch begin receive after cond fun let query +syn keyword erlangKeyword try catch begin receive after cond fun let syn keyword erlangConditional case if of end syn keyword erlangConditional not and or andalso orelse @@ -75,52 +75,57 @@ syn match erlangBitSize /:\@<=[0-9]\+/ syn match erlangBinary /<<\|>>/ " BIFs -syn match erlangBIF /\%([^:0-9A-Za-z_]\|\<erlang:\|^\)\@<=\%(abs\|apply\|atom_to_binary\|atom_to_list\|binary_part\|binary_to_atom\|binary_to_existing_atom\|binary_to_list\|binary_to_term\|bit_size\|bitstring_to_list\|byte_size\|check_process_code\|date\|delete_module\|demonitor\|disconnect_node\|element\|erase\|error\|exit\|float\|float_to_list\|garbage_collect\|get\|get_keys\|group_leader\|halt\|hd\|integer_to_list\|iolist_size\|iolist_to_binary\|is_alive\|is_atom\|is_binary\|is_bitstring\|is_boolean\|is_float\|is_function\|is_integer\|is_list\|is_number\|is_pid\|is_port\|is_process_alive\|is_record\|is_reference\|is_tuple\|length\|link\|list_to_atom\|list_to_binary\|list_to_bitstring\|list_to_existing_atom\|list_to_float\|list_to_integer\|list_to_pid\|list_to_tuple\|load_module\|make_ref\|max\|min\|module_loaded\|monitor\|monitor_node\|node\|nodes\|now\|open_port\|pid_to_list\|port_close\|port_command\|port_connect\|port_control\|pre_loaded\|processes\|process_flag\|process_info\|purge_module\|put\|register\|registered\|round\|self\|setelement\|size\|spawn\|spawn_link\|spawn_monitor\|spawn_opt\|split_binary\|statistics\|term_to_binary\|throw\|time\|tl\|trunc\|tuple_size\|tuple_to_list\|unlink\|unregister\|whereis\)\%((\|\/[0-9]\)\@=/ +syn match erlangBIF /\%([^:0-9A-Za-z_]\|\<erlang:\|^\)\@<=\%(abs\|apply\|atom_to_binary\|atom_to_list\|binary_part\|binary_to_atom\|binary_to_existing_atom\|binary_to_float\|binary_to_integer\|binary_to_list\|binary_to_term\|bit_size\|bitstring_to_list\|byte_size\|check_process_code\|date\|delete_module\|demonitor\|disconnect_node\|element\|erase\|error\|exit\|float\|float_to_binary\|float_to_list\|garbage_collect\|get\|get_keys\|group_leader\|halt\|hd\|integer_to_binary\|integer_to_list\|iolist_size\|iolist_to_binary\|is_alive\|is_atom\|is_binary\|is_bitstring\|is_boolean\|is_float\|is_function\|is_integer\|is_list\|is_number\|is_pid\|is_port\|is_process_alive\|is_record\|is_reference\|is_tuple\|length\|link\|list_to_atom\|list_to_binary\|list_to_bitstring\|list_to_existing_atom\|list_to_float\|list_to_integer\|list_to_pid\|list_to_tuple\|load_module\|make_ref\|max\|min\|module_loaded\|monitor\|monitor_node\|node\|nodes\|now\|open_port\|pid_to_list\|port_close\|port_command\|port_connect\|port_control\|pre_loaded\|processes\|process_flag\|process_info\|purge_module\|put\|register\|registered\|round\|self\|setelement\|size\|spawn\|spawn_link\|spawn_monitor\|spawn_opt\|split_binary\|statistics\|term_to_binary\|throw\|time\|tl\|trunc\|tuple_size\|tuple_to_list\|unlink\|unregister\|whereis\)\%((\|\/[0-9]\)\@=/ syn match erlangBIF /\%(\<erlang:\)\@<=\%(append_element\|bump_reductions\|cancel_timer\|decode_packet\|display\|function_exported\|fun_info\|fun_to_list\|get_cookie\|get_stacktrace\|hash\|is_builtin\|loaded\|load_nif\|localtime\|localtime_to_universaltime\|make_tuple\|memory\|monitor_node\|phash\|port_call\|port_info\|ports\|port_to_list\|process_display\|read_timer\|ref_to_list\|resume_process\|send\|send_after\|send_nosuspend\|set_cookie\|start_timer\|suspend_process\|system_flag\|system_info\|system_monitor\|system_profile\|trace\|trace_delivered\|trace_info\|trace_pattern\|universaltime\|universaltime_to_localtime\|yield\)(\@=/ syn match erlangGBIF /\<erlang\%(:\w\)\@=/ +" Functions +syn match erlangFunc /^\w\+\s*(\@=/ +syn match erlangFunc /^'[^']\+'\s*(\@=/ + " Link Erlang stuff to Vim groups -hi link erlangTodo Todo -hi link erlangString String -hi link erlangNoSpellString String -hi link erlangModifier SpecialChar -hi link erlangStringModifier SpecialChar -hi link erlangComment Comment -hi link erlangAnnotation Special -hi link erlangVariable Identifier -hi link erlangInclude Include -hi link erlangRecordDef Keyword -hi link erlangAttribute Keyword -hi link erlangKeyword Keyword -hi link erlangMacro Macro -hi link erlangDefine Define -hi link erlangPreCondit PreCondit -hi link erlangPreProc PreProc -hi link erlangDelimiter Delimiter -hi link erlangBitDelimiter Normal -hi link erlangOperator Operator -hi link erlangConditional Conditional -hi link erlangGuard Conditional -hi link erlangBoolean Boolean -hi link erlangAtom Constant -hi link erlangRecord Structure -hi link erlangInteger Number -hi link erlangFloat Number -hi link erlangFloat Number -hi link erlangFloat Number -hi link erlangFloat Number -hi link erlangHex Number -hi link erlangFun Keyword -hi link erlangList Delimiter -hi link erlangTuple Delimiter -hi link erlangBinary Keyword -hi link erlangBitVariable Identifier -hi link erlangBitType Type -hi link erlangType Type -hi link erlangBitSize Number +hi def link erlangTodo Todo +hi def link erlangString String +hi def link erlangNoSpellString String +hi def link erlangModifier SpecialChar +hi def link erlangStringModifier SpecialChar +hi def link erlangComment Comment +hi def link erlangAnnotation Special +hi def link erlangVariable Identifier +hi def link erlangInclude Include +hi def link erlangRecordDef Keyword +hi def link erlangAttribute Keyword +hi def link erlangKeyword Keyword +hi def link erlangMacro Macro +hi def link erlangDefine Define +hi def link erlangPreCondit PreCondit +hi def link erlangPreProc PreProc +hi def link erlangDelimiter Delimiter +hi def link erlangBitDelimiter Normal +hi def link erlangOperator Operator +hi def link erlangConditional Conditional +hi def link erlangGuard Conditional +hi def link erlangBoolean Boolean +hi def link erlangAtom Constant +hi def link erlangRecord Structure +hi def link erlangInteger Number +hi def link erlangFloat Number +hi def link erlangFloat Number +hi def link erlangFloat Number +hi def link erlangFloat Number +hi def link erlangHex Number +hi def link erlangFun Keyword +hi def link erlangList Delimiter +hi def link erlangTuple Delimiter +hi def link erlangBinary Keyword +hi def link erlangBitVariable Identifier +hi def link erlangBitType Type +hi def link erlangType Type +hi def link erlangBitSize Number +hi def link erlangFunc Function " Optional highlighting if g:erlang_highlight_bif - hi link erlangBIF Keyword - hi link erlangGBIF Keyword + hi def link erlangBIF Keyword + hi def link erlangGBIF Keyword endif
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor