Re: ff fenc bin in modeline
Yasuhiro Matsumoto wrote: > > 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. > > See from a different (may be user's) viewpoint this, it looks like you > said that modeline should be separated in two sub modes: ex. > lead_modeline and trail_modeline. And operations allowed in those two > modelines are little different. > > Is this my understanding right? It's a compromise. Handling of 'fileencoding' in a modeline will be different anyway. Other options don't change the way a file is loaded. Another solution would be to also check the modelines at the end of the file, then the whole file needs to be reloaded. While finding a 'fenc' setting near the start of the file reloads only a small part of the file. This could be handled like finding an illegal byte in a file. Then it can be reloaded with a different encoding too. -- You can tune a file system, but you can't tuna fish -- man tunefs /// 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///
Re: ff fenc bin in modeline
2006/8/26, Bram Moolenaar <[EMAIL PROTECTED]>: 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/// See from a different (may be user's) viewpoint this, it looks like you said that modeline should be separated in two sub modes: ex. lead_modeline and trail_modeline. And operations allowed in those two modelines are little different. Is this my understanding right? -- MURAOKA Taro <[EMAIL PROTECTED]>
Re: ff fenc bin in modeline
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///
Re: ff fenc bin in modeline
Bram - 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. A.J.Mechelynck - Suggestion: Delay this patch until the next point release, so that it can be handled with vim701: fenc=latin1 Yes, I think so. :-) Higher Regards Too. Thanks. - Yasuhiro Matsumoto
Re: ff fenc bin in modeline
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. -- >From the classified section of a city newspaper: Dog for sale: eats anything and is fond of children. /// 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///
Re: ff fenc bin in modeline
Bram Moolenaar wrote: 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. Suggestion: Delay this patch until the next point release, so that it can be handled with vim701: fenc=latin1 Best regards, Tony.