On Tue, 12 Dec 2006 17:20:15 +0800, mbbill <[EMAIL PROTECTED]> wrote:
> Hello Matthew, > > Tuesday, December 12, 2006, 5:00:30 PM, you wrote: > > >?On Mon, 11 Dec 2006 19:00:27 +0800, [EMAIL PROTECTED] wrote: > > >>?No, this is not a "problem". This is a "feature"... ;-) > > >?It's not even a feature. It's the right way of doing things. > > >?The character (or characters, if it's a DOS file) at the end of each > >?line aren't line _separators_ but line _terminators_. Every line > >?should end the same way, including the final one. That notepad doesn't > >?do this is a long-standing bug in notepad, and is just one of the > >?many, many reasons why nobody should use notepad for anything. > > But Emacs does not have the "feature" either . Then Emacs is wrong too. A text file is DEFINED as having lines terminated by a line termination sequence. On Unix this is a line feed, on DOS it's a carriage return/line feed pair, and on a Mac it's a carriage return. But this terminator IS NOT OPTIONAL. It's not "All lines must be terminated by a line terminator except the last one". You can no more omit the line terminator on the final line than you can on any other line. If you do omit the final terminator the result is no longer a text file. If you really do want to omit the final line terminator then Vim will allow it if you "set binary noendofline", but you should be aware that many programs that expect to read text files will break when using such a file as input because they don't contain extra code to deal with the special case of the last line of the input having no terminator. (Oracle's SQL*Plus, for example, throws a warning about truncated input. This is reasonable behaviour because an unterminated line is exactly what you'd get if the input was truncated.) -- Matthew Winn