unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* what are some example case of files needing newline at end?
@ 2008-12-06  7:17 Xah Lee
  2008-12-06  9:49 ` Andy Stewart
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Xah Lee @ 2008-12-06  7:17 UTC (permalink / raw)
  To: help-gnu-emacs

what are some examples of files that requires a newline by itself at
the end?

Detail:

recently i'm coding elisp to process a input file line by line. Each
line is expected to have text.
I ran into error at the last line because the file has a empty line,
and i noticed that it is automatically added, due to mode-require-
final-newline being true.

So, i'm wondering, what kinda files actually require newline at the
end? and if it is still so today?

  Xah
∑ http://xahlee.org/^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: what are some example case of files needing newline at end?
  2008-12-06  7:17 what are some example case of files needing newline at end? Xah Lee
@ 2008-12-06  9:49 ` Andy Stewart
  2008-12-06  9:55 ` Jean-Marc Bourguet
  2008-12-06 18:39 ` Chris F.A. Johnson
  2 siblings, 0 replies; 4+ messages in thread
From: Andy Stewart @ 2008-12-06  9:49 UTC (permalink / raw)
  To: help-gnu-emacs

Hi Xah,

I think crontab file need newline at end of file.
If have not newline at end of crontab file.

crontab can't work.

  -- Andy

Xah Lee <xahlee@gmail.com> writes:

> what are some examples of files that requires a newline by itself at
> the end?
>
> Detail:
>
> recently i'm coding elisp to process a input file line by line. Each
> line is expected to have text.
> I ran into error at the last line because the file has a empty line,
> and i noticed that it is automatically added, due to mode-require-
> final-newline being true.
>
> So, i'm wondering, what kinda files actually require newline at the
> end? and if it is still so today?
>
>   Xah
> ∑ http://xahlee.org/
>
> ☄





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: what are some example case of files needing newline at end?
  2008-12-06  7:17 what are some example case of files needing newline at end? Xah Lee
  2008-12-06  9:49 ` Andy Stewart
@ 2008-12-06  9:55 ` Jean-Marc Bourguet
  2008-12-06 18:39 ` Chris F.A. Johnson
  2 siblings, 0 replies; 4+ messages in thread
From: Jean-Marc Bourguet @ 2008-12-06  9:55 UTC (permalink / raw)
  To: help-gnu-emacs

Xah Lee <xahlee@gmail.com> writes:

> what are some examples of files that requires a newline by itself at
> the end?

Under Posix, the newline is a line *terminator* not a line *separator*, so
a Posix text file must be terminated by a newline.

> recently i'm coding elisp to process a input file line by line. Each
> line is expected to have text.
> I ran into error at the last line because the file has a empty line,
> and i noticed that it is automatically added, due to mode-require-
> final-newline being true.

A file terminated by an empty line will have two newlines at its end under
Posix.

Yours,

-- 
Jean-Marc


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: what are some example case of files needing newline at end?
  2008-12-06  7:17 what are some example case of files needing newline at end? Xah Lee
  2008-12-06  9:49 ` Andy Stewart
  2008-12-06  9:55 ` Jean-Marc Bourguet
@ 2008-12-06 18:39 ` Chris F.A. Johnson
  2 siblings, 0 replies; 4+ messages in thread
From: Chris F.A. Johnson @ 2008-12-06 18:39 UTC (permalink / raw)
  To: help-gnu-emacs

On 2008-12-06, Xah Lee wrote:
> what are some examples of files that requires a newline by itself at
> the end?
>
> Detail:
>
> recently i'm coding elisp to process a input file line by line. Each
> line is expected to have text.
> I ran into error at the last line because the file has a empty line,
> and i noticed that it is automatically added, due to mode-require-
> final-newline being true.

    I have never seen a blank line added. If there is no newline at
    the end of the file, one will be added. That is not a blank line.
    a blank line at the end would mean two newlines at the end of the
    file.

> So, i'm wondering, what kinda files actually require newline at the
> end? and if it is still so today?

    A final newline is required by many UNIX utilities. The POSIX
    definition of a text file is one that ends with a newline.


-- 
   Chris F.A. Johnson, author   |    <http://cfaj.freeshell.org>
   Shell Scripting Recipes:     |  My code in this post, if any,
   A Problem-Solution Approach  |         is released under the
   2005, Apress                 |    GNU General Public Licence


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-12-06 18:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-06  7:17 what are some example case of files needing newline at end? Xah Lee
2008-12-06  9:49 ` Andy Stewart
2008-12-06  9:55 ` Jean-Marc Bourguet
2008-12-06 18:39 ` Chris F.A. Johnson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).