Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Delete trailing CR?

5 views
Skip to first unread message

Anonymous

unread,
Nov 2, 2012, 8:25:31 AM11/2/12
to help-gn...@gnu.org
Hi. In Emacs how do I edit a file without Emacs adding a 0a byte to the end?
And how do I delete that character if it is already in the file?
M-x delete-trailing-whitespace leaves this character at the end of the file.
Thank you.

Barry Margolin

unread,
Nov 2, 2012, 11:53:13 AM11/2/12
to
In article <mailman.12153.1351870...@gnu.org>,
That's not a CR (CR is 0d), it's an LF, i.e. newline. The variable you
want to customize is require-final-newline.

But why would you want to remove it? Text files should be a sequence of
lines, and each line should end with a newline. Some programs don't
process the last line correctly if it doesn't end with a newline.

--
Barry Margolin, bar...@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***

Dave U. Random

unread,
Nov 5, 2012, 11:33:30 AM11/5/12
to help-gn...@gnu.org
Hi Barry,

> In article <mailman.12153.1351870...@gnu.org>,
> Anonymous <nob...@slug.slugish.net> wrote:
>
> > Hi. In Emacs how do I edit a file without Emacs adding a 0a byte to the end?
> > And how do I delete that character if it is already in the file?
> > M-x delete-trailing-whitespace leaves this character at the end of the file.
> > Thank you.
>
> That's not a CR (CR is 0d), it's an LF, i.e. newline. The variable you
> want to customize is require-final-newline.

Thanks alot on both counts!

> But why would you want to remove it? Text files should be a sequence of
> lines, and each line should end with a newline. Some programs don't
> process the last line correctly if it doesn't end with a newline.

I was working on test data and I needed to check files of certain
lengths. Before I read your reply I accomplished it by using hexl-mode and
changing the last character to data.

Thanks for the info for future use!

Chuck


0 new messages