all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Mekeor Melire <mekeor@posteo.de>
To: Samuel Wales <samologist@gmail.com>
Cc: help-gnu-emacs <help-gnu-emacs@gnu.org>
Subject: Re: fill individual long lines
Date: Wed, 21 Feb 2024 23:02:35 +0000	[thread overview]
Message-ID: <87sf1l8lpd.fsf@posteo.de> (raw)

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	other threads:[~2024-02-21 23:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-21 23:02 Mekeor Melire [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-02-13 23:03 fill individual long lines Samuel Wales

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87sf1l8lpd.fsf@posteo.de \
    --to=mekeor@posteo.de \
    --cc=help-gnu-emacs@gnu.org \
    --cc=samologist@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.