unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* How to use function `insert' with wrapping?
@ 2021-06-12 17:55 Jean Louis
  2021-06-12 18:00 ` Eli Zaretskii
  0 siblings, 1 reply; 3+ messages in thread
From: Jean Louis @ 2021-06-12 17:55 UTC (permalink / raw)
  To: Help GNU Emacs

I would like to use the function `insert' so that it wraps at expected
`fill-column' is that possible?

(let ((count 0)
      (fill-column 1))
  (while (< count 100)
  (insert "hello ")
  (setq count (1+ count))))
     


Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



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

* Re: How to use function `insert' with wrapping?
  2021-06-12 17:55 How to use function `insert' with wrapping? Jean Louis
@ 2021-06-12 18:00 ` Eli Zaretskii
  2021-06-12 18:17   ` Jean Louis
  0 siblings, 1 reply; 3+ messages in thread
From: Eli Zaretskii @ 2021-06-12 18:00 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Sat, 12 Jun 2021 20:55:31 +0300
> From: Jean Louis <bugs@gnu.support>
> 
> I would like to use the function `insert' so that it wraps at expected
> `fill-column' is that possible?

No.  'insert' just inserts the text in the buffer.

What you need is call fill-region or fill-region-as-paragraph after
the insertion.



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

* Re: How to use function `insert' with wrapping?
  2021-06-12 18:00 ` Eli Zaretskii
@ 2021-06-12 18:17   ` Jean Louis
  0 siblings, 0 replies; 3+ messages in thread
From: Jean Louis @ 2021-06-12 18:17 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: help-gnu-emacs

* Eli Zaretskii <eliz@gnu.org> [2021-06-12 21:03]:
> > Date: Sat, 12 Jun 2021 20:55:31 +0300
> > From: Jean Louis <bugs@gnu.support>
> > 
> > I would like to use the function `insert' so that it wraps at expected
> > `fill-column' is that possible?
> 
> No.  'insert' just inserts the text in the buffer.
> 
> What you need is call fill-region or fill-region-as-paragraph after
> the insertion.

Aha, that is it.

I was using this:

(when (> (current-column) 70) (insert "\n")))))



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

end of thread, other threads:[~2021-06-12 18:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-06-12 17:55 How to use function `insert' with wrapping? Jean Louis
2021-06-12 18:00 ` Eli Zaretskii
2021-06-12 18:17   ` Jean Louis

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