all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: gareth.rees@pobox.com (Gareth Rees)
Subject: Re: unfill/defill
Date: 31 Mar 2003 05:11:19 -0800	[thread overview]
Message-ID: <e867ce6d.0303310511.2deea108@posting.google.com> (raw)
In-Reply-To: Xns934EE35B595F9chrislak@216.168.3.44

chrisl_ak@hotmail.com wrote:
> I sometimes need to take a few paragraphs (2-20) from a text file
> created in Emacs using auto-fill and put them into another
> application. All paragraphs are separated by a blank line. What is the
> simplest way to "unfill" or "defill" these paragraphs so that each
> paragraph is one long line? Ideally I could highlight the whole region
> with the paragraphs I need and unfill them all at once, but retain a
> blank line between each one...

You can "unfill" all the paragraphs in the region by setting
`fill-column' to a large number and executing `fill-region', then
removing blank lines between paragraphs.  For example

  (defun unfill-region (start end)
     (interactive "r")
     (save-excursion
       (save-restriction
         (let ((fill-column (point-max)))
           (fill-region (point-min) (point-max) nil t)
           (goto-char (point-min))
           (while (search-forward "\n\n" nil t)
             (replace-match "\n"))))))

(It seems to me that on operating systems that have "rich text"
clipboard formats, such as Windows and Macintosh, you ought to be able
to do this by turning on Enriched Mode and then just copying and
pasting.  But Emacs 21 doesn't provide this.)

-- 
Gareth Rees

      parent reply	other threads:[~2003-03-31 13:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-31  7:23 unfill/defill Chris
2003-03-31  8:41 ` unfill/defill David Kastrup
2003-03-31 13:11 ` Gareth Rees [this message]

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=e867ce6d.0303310511.2deea108@posting.google.com \
    --to=gareth.rees@pobox.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.