[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: elisp - inserting block of text
From: |
Pascal J. Bourguignon |
Subject: |
Re: elisp - inserting block of text |
Date: |
Wed, 01 Dec 2010 15:12:34 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) |
Gary <help-gnu-emacs@garydjones.name> writes:
> What function(s) do I need to use in order to insert some text, please?
>
> 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.
(insert "Hello
world!")
or:
(insert "Hello\nworld!")
A buffer only contains lines, independently from the encoding used to
store it in a file. You may want to insert carriage return characters
in a buffer (but I wouldn't advise doing so, better to stick to
characters, and avoid control codes, in text files).
(insert "Hello
world!")
or:
(insert "Hello\r\nworld!")
Type: C-q C-m to insert a carriage return,
and: C-q C-j to insert a line feed.
--
__Pascal Bourguignon__ http://www.informatimago.com/
A bad day in () is better than a good day in {}.