> So, I'm probably dropping the pure Vim indent and taking the new one
> in Erlang for Vimerl. This Erlang indenter isn't gonna be included in
> the official Vim distribution, so that Csaba should keep his version
> if he can mantain it. As it seems a good default one for Vim.

I hope you can make it work like the Erlang indentation of Emacs,
which seems to be the de facto standard for indenting Erlang code :)

>> About the syntax file: The syntax file in vimerl was written by Oscar
>> Hellström from scratch AFAIK, so it is quite different from the syntax
>> file currently in Vim (written originally by Kresimir Marzic and is
>> now maintained by me). I would advise against replacing the syntax
>> file, because changing the Erlang syntax highlight drastically would
>> be a negative user experience. The two files could be compared though
>> and the current Vim version could be improved by ideas from the other.
>
> I have the impression (maybe wrong) that the syntax file from Oscar is
> more complete, but it's your call Csaba :-)

Oscar's file indeed contains some things that could (should) be
incorporated into the current one; but their styles are also
different. For example the current one highlights the global calls
(module:function) and does not highlight local calls or variables;
while Oscar's file highlights variables and not function calls. Both
are good algorithms, but I don't think we should change from one style
to the other in the standard Vim distribution.

> The variable `g:erlang_folding' controls if the specific folding for
> Erlang is enabled. I did this because it's what I saw in most of the
> plugins distributed with Vim. I'm fine with any solution as long as it
> is the most standard one. Also I recently removed a lot of code from
> folding to keep as simple as possible[4].
>
> [4] https://github.com/jimenezrick/vimerl/blob/master/ftplugin/erlang.vim

I examined the version packaged by Per, which was version 1.1.1. But
since then you have released 1.2, and that new version does actually
contain the `g:erlang_folding'  variable, which perfectly solves the
problem that I pointed out.

Whether that or the even newer version ([4] above) should be used,
that is your call, Ricardo :)

>> 2. Remove this line:
>>
>>       setlocal omnifunc=erlang_complete#Complete"

Also, there is a similar problem in the ftplugin file with calling
":compiler erlang". If there is no compiler/erlang.vim, that gives an
error.

>>   If we don't add autoload/erlang_complete.vim, which actually implements 
>> this
>>   function, this function should not be used.
>
> OK, but maybe this could be automatically set at runtime. Detecting if
> erlang_complete.vim exists or something like that...

I haven't found an easy solution. The autoload functionality in Vim
will try to look up the file (autoload/erlang_complete.vim in this
case) in each directory in 'runtimepath', but you cannot ask in
advance whether a file exists in any of these directories or not.

One option is to parse the value of 'runtimepath' and check the
existence of the files ourselves -- I would rather not do that.

Another option is to call erlang_complete#Complete and examine the
error. If we get "E117 Unknown function" error, then the file does not
exist; otherwise we are just calling the function in a wrong way
(without arguments).

    silent! call erlang_complete#Complete()
    if strpart(v:errmsg, 0, 4) != 'E117' " E117: Unknown function
        compiler erlang
        setlocal omnifunc=erlang_complete#Complete
    endif

Maybe the third option is the simplest: not to have these two lines in
the version of ftplugin shipped with Vim. (Although I know that it is
worse from a version contol point of view.)

Any of these solutions is fine for me, but something has to be done,
otherwise the "compiler error" line will give an error when opening an
Erlang file and the "omnifunc" line will give an "Unknown function"
error when typing i_C-x_C-o.

Regards,
Csaba

-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Raspunde prin e-mail lui