help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: elisp - inserting block of text


From: Eli Zaretskii
Subject: Re: elisp - inserting block of text
Date: Wed, 01 Dec 2010 19:20:51 +0200

> From: Tassilo Horn <tassilo@member.fsf.org>
> Date: Wed, 01 Dec 2010 17:22:01 +0100
> 
> > I know about 'insert', but am wondering how I would go about inserting
> > line breaks, for example, when the buffer might contain a file with
> > *n*x or DOS line endings, or even a mix of the two.

The _buffer_ never contains any line endings but the Unix ones.  The
_file_ that is visited by the buffer could have any style of line
endings and even a mix of them, but a buffer cannot.

> (insert "foo\nbar\n") inserts foo and bar, and after each one the right
> newline, carriage-return, or both, depending on the buffer's coding
> system.

No, it always insert a single newline.  The buffer's coding system is
only important when the buffer is saved to its file.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]