From: "B. T. Raven" <nihil@nihilo.net>
To: help-gnu-emacs@gnu.org
Subject: Re: Refilling paragraphs to remove hard returns?
Date: Wed, 05 May 2010 08:07:17 -0500 [thread overview]
Message-ID: <7LudnT-35O8Y8HzWnZ2dnUVZ_hKdnZ2d@sysmatrix.net> (raw)
In-Reply-To: <hrrnte$vdc$1@news.onet.pl>
Marc Mientki wrote:
> Am 05.05.2010 13:50, schrieb Jesse Sheidlower:
>> I imagine this is a common problem, so I don't know why I'm
>> having so much trouble finding an answer.
>>
>> Suppose I have a text document that I've worked on in
>> text-mode. It is filled using the usual fill tools, so it
>> wraps at 72 characters, with a hard return after each line.
>> Paragraphs are separated by an extra hard return; there's no
>> other indentation.
>>
>> I now need to give this document to someone who wants to work
>> on it in a word processor, who complains that there are hard
>> returns after every line. What's the easy way to remove these?
>
> Some way may be unfill-region, that I found here at NG some years
> ago:
>
> (defun unfill-region (start end)
> "Make all START to END a single line."
> (interactive "*r")
> (save-excursion
> (goto-char end)
> (while
> (progn (goto-char (point-at-bol)) (< start (point)))
> (delete-indentation))))
>
>
> But for long texts I use simply fill-paragraph or
> fill-individual-paragraphs on whole text (buffer is in
> text-mode, no longlines-mode is active). The result is
> one lines per paragraph.
>
> regards
> Marc
>
These also work (with the help of a large magic number). I don't know if
it's better practice to use interactive "r" and start, end or point and
mark:
(defun unfill-paragraph () ;; bound to C-x M-q
"Do the opposite of fill-paragraph; stuff all lines in the current
paragraph into a single long line."
(interactive)
(let ((fill-column 90002000))
(fill-paragraph nil)))
(defun unfill-region () ;; bound to C-x s-q
"Do the opposite of fill-region; stuff all paragraphs in the current
region into long lines."
(interactive)
(let ((fill-column 90002000))
(fill-region (point) (mark))))
next prev parent reply other threads:[~2010-05-05 13:07 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-05 11:50 Refilling paragraphs to remove hard returns? Jesse Sheidlower
2010-05-05 12:22 ` Marc Mientki
2010-05-05 13:07 ` B. T. Raven [this message]
2010-05-05 13:12 ` Xah Lee
2010-05-05 17:29 ` Uday S Reddy
2010-05-06 17:53 ` jpkotta
2010-05-06 18:08 ` Ross A. Laird
2010-05-07 5:38 ` Jonathan Groll
2010-05-07 13:08 ` Lennart Borgman
2010-05-07 13:36 ` Jonathan Groll
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=7LudnT-35O8Y8HzWnZ2dnUVZ_hKdnZ2d@sysmatrix.net \
--to=nihil@nihilo.net \
--cc=help-gnu-emacs@gnu.org \
/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.