* Delete trailing CR?
@ 2012-11-02 12:25 Anonymous
0 siblings, 0 replies; 3+ messages in thread
From: Anonymous @ 2012-11-02 12:25 UTC (permalink / raw)
To: help-gnu-emacs
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.
^ permalink raw reply [flat|nested] 3+ messages in thread
[parent not found: <mailman.12153.1351870877.855.help-gnu-emacs@gnu.org>]
* Re: Delete trailing CR?
[not found] <mailman.12153.1351870877.855.help-gnu-emacs@gnu.org>
@ 2012-11-02 15:53 ` Barry Margolin
2012-11-05 16:33 ` Dave U. Random
0 siblings, 1 reply; 3+ messages in thread
From: Barry Margolin @ 2012-11-02 15:53 UTC (permalink / raw)
To: help-gnu-emacs
In article <mailman.12153.1351870877.855.help-gnu-emacs@gnu.org>,
Anonymous <nobody@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.
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, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Delete trailing CR?
2012-11-02 15:53 ` Barry Margolin
@ 2012-11-05 16:33 ` Dave U. Random
0 siblings, 0 replies; 3+ messages in thread
From: Dave U. Random @ 2012-11-05 16:33 UTC (permalink / raw)
To: help-gnu-emacs
Hi Barry,
> In article <mailman.12153.1351870877.855.help-gnu-emacs@gnu.org>,
> Anonymous <nobody@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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-11-05 16:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-02 12:25 Delete trailing CR? Anonymous
[not found] <mailman.12153.1351870877.855.help-gnu-emacs@gnu.org>
2012-11-02 15:53 ` Barry Margolin
2012-11-05 16:33 ` Dave U. Random
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).