Yasuhiro Matsumoto wrote:

> >>vim can't treat ff and fenc, bin option on modelines. We can specify
> >>'fencs' for judging some encodings. But vim often mis-judge when
> >>opening a text file. If we can set 'fenc' on modeline, vim won't
> >>fail.
> >>
> >>I wrote a patch for this support. Please check and include.
> >>#This patch include support of ff and bin.
> >
> >I understand the desire to make something like this, but I can't say I
> >like it.
> >
> >I don't see much use in setting the 'bin' option in a modeline.  And
> >certainly not in switching it off.
> >
> >Same is true for 'fileformat'.  Vim detects this quite reliably.  If
> >'fileformat' appears in a modeline it's probably a mistake of the user.
> >
> >For 'fileencoding' it can be useful, since Vim can't always detect the
> >encoding of the file.  The current patch first loads the whole file,
> >checks the modelines and then may load the file again.  That's a bit
> >unexpected.  In readfile() there already is a loop to retry another
> >fileformat.  I think this is also the place to handle the modeline.
> >This does require a more complicated patch, but it's worth it.
> >
> >I think that when "++enc=name" is used the fileencoding value of the
> >modeline should not be used.
> >
> >There is a small problem with backwards compatibility: Previously
> >setting 'fileencoding' in the modeline caused conversion when the file
> >was written.  Mostly this was a mistake though, and hardly ever useful.
> 
> Modelines can be set also at bottom lines. So, it may be difficult to
> process modelines in readline() for vim.  I guess that it should be this
> place.
> 
> If it will not cause an infinite loop, this reload is very useful. The
> people who needs this processing method 'fenc' in modelines, don't care
> overhead of reading a file few times. and the people who use this
> feature are sure to understand it.

It's just a matter of time before someone complains about the reloading
or finds a good reason to avoid it.  E.g. where autocommands are
involved.

Although modelines can also appear near the end of the file, they are
mostly at the start.  Requiring 'fenc' to be set in one of the first
lines doesn't sound unreasonable to me.

It is still sort of an exception to handle 'fenc' in a modeline this way.
But it's probably worth it.  As Tony mentioned.  Doing this in Vim 7.1
would be a good idea.

-- 
hundred-and-one symptoms of being an internet addict:
230. You spend your Friday nights typing away at your keyboard

 /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

Reply via email to