On 2/28/07, asdasd asdasd <[EMAIL PROTECTED]> wrote:
--- Yakov Lerner <[EMAIL PROTECTED]> wrote:
> > Now, how do I get whether the current buffer last
> char
> > is EOL or not? Maybe the '&eol' variable?
>
> Yes, it's in &eol variable. Will be 1 if file had
> last newline
> (common case), 0 if file did dnot have last newline.
I've been checking this, and what the eol variable
produces is whether the original file read had an eol
as last char or not. Compare this with whether the
last bang command (which substituted all contents with
something coming from my script) produced contents
where the last byte was eol or not.

You can easily work around this. As follows:
1. Always set noeof before saving/writing your buffer.
2. Have your script produce additional empty line
at end of its output when you need that last \n in the final output file.
3. Have your script not produce additional last empty
line when you need no final \n in the final output file.

That's it. Hope it works for you.

Yakov

Reply via email to