unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* fill individual long lines
@ 2024-02-13 23:03 Samuel Wales
  0 siblings, 0 replies; 2+ messages in thread
From: Samuel Wales @ 2024-02-13 23:03 UTC (permalink / raw)
  To: help-gnu-emacs

i want a command that will fill paragraphs that are long lines and
that have no blank lines between them.

for example, today, i received an email, intended as list items,
which, when copied from the webmail to emacs, resulted in soemthing
like this:

  line 1 hello ajs dnfkansd fklja sndlkfj anskdj nfalksjd nflaksjn
dfkajs ndfkjn asdkjf naksjd nfkajsnd fkja sndkfj naskdj nfakjsdn fkajs
ndkfjn askdjn faksjdnfkajsndfkjansdkfjnalksdjfn
  another line k naskjdfn alksj fndlkajsnd fkjans dklfjan sdklfjn
aksdjnf kaljsd nfkjasn dklfjn aksdjn fkajsdn fklaj nsdkfn aksdj
fnlkasjdnfffkdnfkajn sdkfjnaskdjfnkasjdnkfjan

and so on.  in other words, every line is too long, but if i just
filled with m-q, it would smush all list items into one long
paragraph.  each line is a list item.

what i want is for the result to be like:

  line 1 hello ajs dnfkansd fklja sndlkfj anskdj nfalksjd
  nflaksjn dfkajs ndfkjn asdkjf naksjd nfkajsnd fkja sndkfj
  naskdj nfakjsdn fkajs ndkfjn askdjn
  faksjdnfkajsndfkjansdkfjnalksdjfn

  another line k naskjdfn alksj fndlkajsnd fkjans dklfjan
  sdklfjn aksdjnf kaljsd nfkjasn dklfjn aksdjn fkajsdn fklaj
  nsdkfn aksdj fnlkasjdnfffkdnfkajn sdkfjnaskdjfnkasjdnkfjan

or even, for super duper fanciness, have each original line become an org list
item.  [not always needed, but the intent of this email was bullets .]

please copy me on any reply if possible as it is hard to find things
sent to me on this mailing list.  thank you.

-- 
The Kafka Pandemic

A blog about science, health, human rights, and misopathy:
https://thekafkapandemic.blogspot.com



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

* Re: fill individual long lines
@ 2024-02-21 23:02 Mekeor Melire
  0 siblings, 0 replies; 2+ messages in thread
From: Mekeor Melire @ 2024-02-21 23:02 UTC (permalink / raw)
  To: Samuel Wales; +Cc: help-gnu-emacs

2024-02-13 16:03 samologist@gmail.com:

> i want a command that will fill paragraphs that are long lines and
> that have no blank lines between them.

Do you want us to write the code for you? Personally, I neither have
enough expertise nor time for that, I'm sorry.

> for example, today, i received an email, intended as list items,
> which, when copied from the webmail to emacs, resulted in soemthing
> like this:
>
>   line 1 hello ajs dnfkansd fklja sndlkfj anskdj nfalksjd nflaksjn
> dfkajs ndfkjn asdkjf naksjd nfkajsnd fkja sndkfj naskdj nfakjsdn fkajs
> ndkfjn askdjn faksjdnfkajsndfkjansdkfjnalksdjfn another line k
> naskjdfn alksj fndlkajsnd fkjans dklfjan sdklfjn aksdjnf kaljsd
> nfkjasn dklfjn aksdjn fkajsdn fklaj nsdkfn aksdj fnlkasjdnfffkdnfkajn
> sdkfjnaskdjfnkasjdnkfjan
>
> and so on. in other words, every line is too long, but if i just
> filled with m-q, it would smush all list items into one long
> paragraph. each line is a list item.
>
> what i want is for the result to be like:
>
>   line 1 hello ajs dnfkansd fklja sndlkfj anskdj nfalksjd
>   nflaksjn dfkajs ndfkjn asdkjf naksjd nfkajsnd fkja sndkfj
>   naskdj nfakjsdn fkajs ndkfjn askdjn
>   faksjdnfkajsndfkjansdkfjnalksdjfn
>
>   another line k naskjdfn alksj fndlkajsnd fkjans dklfjan
>   sdklfjn aksdjnf kaljsd nfkjasn dklfjn aksdjn fkajsdn fklaj
>   nsdkfn aksdj fnlkasjdnfffkdnfkajn sdkfjnaskdjfnkasjdnkfjan
>
> or even, for super duper fanciness, have each original line become an org list
> item.  [not always needed, but the intent of this email was bullets .]

You could write such a function with these components:

- replace "\n" with "\n\n"
- for each paragraph, call `org-toggle-item'
- for each org item, call `org-fill-paragraph'



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

end of thread, other threads:[~2024-02-21 23:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-21 23:02 fill individual long lines Mekeor Melire
  -- strict thread matches above, loose matches on Subject: below --
2024-02-13 23:03 Samuel Wales

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