unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* elisp - inserting block of text
@ 2010-12-01  8:36 Gary
  2010-12-01 16:22 ` Tassilo Horn
  0 siblings, 1 reply; 4+ messages in thread
From: Gary @ 2010-12-01  8:36 UTC (permalink / raw)
  To: help-gnu-emacs

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.

-- 
Gary        Please do NOT send me 'courtesy' replies off-list.
GNU Emacs 23.2.1
emacsclient 23.2





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

* Re: elisp - inserting block of text
  2010-12-01  8:36 elisp - inserting block of text Gary
@ 2010-12-01 16:22 ` Tassilo Horn
  2010-12-01 17:20   ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: Tassilo Horn @ 2010-12-01 16:22 UTC (permalink / raw)
  To: help-gnu-emacs

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 "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.

Bye,
Tassilo




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

* Re: elisp - inserting block of text
  2010-12-01 16:22 ` Tassilo Horn
@ 2010-12-01 17:20   ` Eli Zaretskii
  2010-12-02 10:13     ` Tassilo Horn
  0 siblings, 1 reply; 4+ messages in thread
From: Eli Zaretskii @ 2010-12-01 17:20 UTC (permalink / raw)
  To: help-gnu-emacs

> 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.



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

* Re: elisp - inserting block of text
  2010-12-01 17:20   ` Eli Zaretskii
@ 2010-12-02 10:13     ` Tassilo Horn
  0 siblings, 0 replies; 4+ messages in thread
From: Tassilo Horn @ 2010-12-02 10:13 UTC (permalink / raw)
  To: help-gnu-emacs

Eli Zaretskii <eliz@gnu.org> writes:

Hi Eli,

>> (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.

Good to know.  But in end, what only matters is that Emacs DTRT. :-)

Bye,
Tassilo




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

end of thread, other threads:[~2010-12-02 10:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-01  8:36 elisp - inserting block of text Gary
2010-12-01 16:22 ` Tassilo Horn
2010-12-01 17:20   ` Eli Zaretskii
2010-12-02 10:13     ` Tassilo Horn

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).