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

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

Re: Refilling paragraphs to remove hard returns?


From: Xah Lee
Subject: Re: Refilling paragraphs to remove hard returns?
Date: Wed, 5 May 2010 06:12:20 -0700 (PDT)
User-agent: G2/1.0

On May 5, 4:50 am, jes...@panix.com (Jesse Sheidlower) wrote:
> 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?
>
> Going forward, I could work on such documents in
> longlines-mode. But it's not clear how to fix what I have. The
> trick mentioned in the Emacs wiki of resetting fill-column to
> a large number and then refilling the region doesn't work,
> because each paragraph is seen as one line, rather than the
> block of text set off by two newlines. Yes, I can regex
> replace all examples of return (not followed by another
> return) with a space, but I'd think there must be something
> more organic.
>
> What trick am I missing?
>
> Thanks.
>
> Jesse Sheidlower

there's unfill-region or something builtin in emacs i think since 22,
but isn't loaded by default... (or was it in )

anyway, there's code here:

• Suggestions on Emacs's Line-Cutting Commands
  http://xahlee.org/emacs/modernization_fill-paragraph.html

or, if you want a simple code, use this:

(defun remove-line-breaks ()
  "Remove line endings in a paragraph."
  (interactive)
  (let ((fill-column (point-max)))
    (fill-paragraph nil)))

from:

• Emacs Lisp Examples
  http://xahlee.org/emacs/elisp_examples.html

  Xah
∑ http://xahlee.org/

reply via email to

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