From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "B. T. Raven" Newsgroups: gmane.emacs.help Subject: Re: Refilling paragraphs to remove hard returns? Date: Wed, 05 May 2010 08:07:17 -0500 Message-ID: <7LudnT-35O8Y8HzWnZ2dnUVZ_hKdnZ2d@sysmatrix.net> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1273087627 28215 80.91.229.12 (5 May 2010 19:27:07 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 5 May 2010 19:27:07 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed May 05 21:26:54 2010 connect(): No such file or directory Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1O9kF8-0007ne-5x for geh-help-gnu-emacs@m.gmane.org; Wed, 05 May 2010 21:26:50 +0200 Original-Received: from localhost ([127.0.0.1]:52046 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O9kF7-0006fE-Gf for geh-help-gnu-emacs@m.gmane.org; Wed, 05 May 2010 15:26:49 -0400 Original-Path: usenet.stanford.edu!postnews.google.com!news2.google.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.sysmatrix.net!news.sysmatrix.net.POSTED!not-for-mail Original-NNTP-Posting-Date: Wed, 05 May 2010 08:07:16 -0500 User-Agent: Thunderbird 2.0.0.23 (Windows/20090812) Original-Newsgroups: gnu.emacs.help In-Reply-To: X-No-Archive: yes Original-Lines: 54 X-Usenet-Provider: http://www.giganews.com Original-NNTP-Posting-Host: 12.73.132.113 Original-X-Trace: sv3-EkXZIBj9iXOfbkzNBOwPCjtye235l+ePTPYCzDqHvQC8qzGjNLsRF97P7V+wdpxZinLS1OG/n4gLitz!MvDdfU+xVXiTkYrW0v1jApmiiLRudyKTRdmrv7IBlpSf5TBOPDdu3SmjAXKTXUpAMandRIhBjCdF!B/xHO6BQDG5EUHY5tQgFOya6Fv0DO2w= Original-X-Complaints-To: abuse@sysmatrix.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 Original-Xref: usenet.stanford.edu gnu.emacs.help:177947 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org X-Gmane-Expiry: 2010-05-19 Xref: news.gmane.org gmane.emacs.help:73472 Archived-At: 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))))