Dear Bram,

Providing an identification string is a great idea, i'll contact the Octave
community and see their reactions and proposals for the string, do you have
any identifier in mind?

if (filename matches *.m)
  if (comment_symbol == '#' || script_last_line == '% octave')
    filetype=octave
  else
    filetype=matlab

Best Regards,
Júlio.

2012/4/15 Bram Moolenaar <[email protected]>

>
> Júlio wrote:
>
> > Not exactly a superset, both languages have peculiarities. The main point
> > is that Octave tries to maintain the best compatibility as possible with
> > MATLAB, including the file extension (*.m) and comment symbol (%).
> Although
> > Octave supports other comment symbols (# and the shebang mechanism), they
> > are ignored by the community which prefers to write scripts that both
> > interpreters can execute.
> >
> > Discussing on IRC, i discovered other languages suffered from the same
> > issue in the past, namely Perl and Prolog have the same file extension
> and
> > VIM devs solved that by adding an additional flag so the user could
> switch
> > the preference for one or another on .vimrc. It would be plausible for
> this
> > case?
>
> The problem is that some users might use both languages. And I rather
> have it work automatically than the user having to add a file setting to
> his configuration.
>
> How about a convention about putting something in the top of the file to
> recognize the language?
>
> > Perhaps adding the octave.vim to the official distribution, an octave
> > filetype keyword, and an additional flag for switch the preference for
> *.m
> > files would solve the problem?
>
> Adding octave files would be fine.  We can add the "octave" filetype
> name easily.  The only problem is with the detection.
>
> --
> DENNIS:  Listen -- strange women lying in ponds distributing swords is no
>         basis for a system of government.  Supreme executive power derives
>         from a mandate from the masses, not from some farcical aquatic
>         ceremony.
>                                   The Quest for the Holy Grail (Monty
> Python)
>
>  /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net
> \\\
> ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/\\\
> \\\  an exciting new programming language -- http://www.Zimbu.org
>  ///
>  \\\            help me help AIDS victims -- http://ICCF-Holland.org
>  ///
>

-- 
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