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

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

Re: fill individual long lines


From: Mekeor Melire
Subject: Re: fill individual long lines
Date: Wed, 21 Feb 2024 23:02:35 +0000

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'



reply via email to

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