From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.help Subject: Re: Reformatting Chat Protocol? Date: Tue, 16 Nov 2010 21:27:56 -0500 Organization: A noiseless patient Spider Message-ID: References: <847d35ff-14aa-44fc-9936-0130d97fe26d@z22g2000pri.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1291891239 32596 80.91.229.12 (9 Dec 2010 10:40:39 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 9 Dec 2010 10:40:39 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Dec 09 11:40:34 2010 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 1PQdvN-0003sK-RX for geh-help-gnu-emacs@m.gmane.org; Thu, 09 Dec 2010 11:40:34 +0100 Original-Received: from localhost ([127.0.0.1]:59632 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PQdvM-0007E4-Pr for geh-help-gnu-emacs@m.gmane.org; Thu, 09 Dec 2010 05:40:32 -0500 Original-Path: usenet.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!news-2.dfn.de!news.dfn.de!newsfeed.straub-nv.de!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 39 Injection-Info: mx01.eternal-september.org; posting-host="35nMxmX0VrcTDyMFSBQRiQ"; logging-data="20448"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/TdEIHrmPkCkx49A7bq79f" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) Cancel-Lock: sha1:N5rvaOMTYfJJuuj1eFPO4sPJB9I= sha1:OYvtrYj0KFrxEg3y1RFVjsXuQCg= Original-Xref: usenet.stanford.edu gnu.emacs.help:182477 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 Xref: news.gmane.org gmane.emacs.help:76962 Archived-At: > In a text file, I want to reformat a block as follows. Its a chat > protocol with various lines longer than the value of `fill-column'. > From: > [11.11.2010 17:01:37] bla bla bla bla bla bla bla bla bla bla bla > bla bla bla bla bla bla bla bla bla bla > [11.11.2010 17:04:21] bla bla bla bla bla > [11.11.2010 17:05:25] bla bla bla > Into: > [11.11.2010 17:01:37] bla bla bla bla bla bla bla bla bla bla bla > bla bla bla bla bla bla bla bla bla bla > [11.11.2010 17:04:21] bla bla bla bla bla bla bla bla bla > [11.11.2010 17:05:25] bla bla bla > Or: > [11.11.2010 17:01:37] bla bla bla bla bla bla bla bla bla bla bla > bla bla bla bla bla bla bla bla bla bla > [11.11.2010 17:04:21] bla bla bla bla bla bla bla bla bla > [11.11.2010 17:05:25] bla bla bla > Any simple solution? I think you've found the simple solution already, but if you want to get "fancy", you can actually teach Emacs how to display those long lines without actually changing the file (i.e. they'll still be continuation lines and the wrapping will dynamically adjust to the window width, but they'll be indented like you want them to be). The simple way is: (setq wrap-prefix " ") If the wrap-prefix needs to be different for different parts of the file, it can also be accommodated, tho it's more complex in that case since you need to set text-properties on each and every line. Stefan