Patrick Texier wrote:

> Le Fri, 23 Jul 2010 17:33:05 +0900, tyru a écrit dans le message
> <aanlkti=d8o=n-cmnnbbr8zkg8k=kpefrsqd+tzruc...@mail.gmail.com> :
> 
> > I wonder why Vim does not disallow changing 'fileencoding' in modeline.
> > However, I've created the patch to disallow it like 'encoding'.
> 
> No, it is the right way to define encoding of a 8-bit file. Vim can not
> choose between ISO-8859-1(15), cp1252, cp1250...

For that you would need to set 'fenc' before reading the file, using ":e
++enc= encoding".  Changing 'fenc' from the mode line only applies to
the next file write, which is quite often not what you want.  In fact,
if Vim recognizes the file as "latin1" (using 'fileencodings'), and you
set 'fenc' to something else, Vim wil try conversion form "latin1" to
that other encoding every time you write the file.

I'm tempted to disallow setting 'fenc' from the modeline to avoid this
kind of mistakes.  I'm trying to think of a valid reason to change
'fenc' in the modeline.  Can't think of one...

-- 
ARTHUR:          But if he was dying, he wouldn't bother to carve
                 "Aaaaarrrrrrggghhh".  He'd just say it.
BROTHER MAYNARD: It's down there carved in stone.
GALAHAD:         Perhaps he was dictating.
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- b...@moolenaar.net -- 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    ///

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