all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: help-gnu-emacs@gnu.org
Subject: Re: Reformatting Chat Protocol?
Date: Tue, 16 Nov 2010 21:27:56 -0500	[thread overview]
Message-ID: <jwvwrochemw.fsf-monnier+gnu.emacs.help@gnu.org> (raw)
In-Reply-To: 847d35ff-14aa-44fc-9936-0130d97fe26d@z22g2000pri.googlegroups.com

> 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


      parent reply	other threads:[~2010-11-17  2:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-14 14:42 Reformatting Chat Protocol? Felix E. Klee
     [not found] ` <87mxpcnefv.fsf@kuiper.lan.informatimago.com>
     [not found]   ` <5084d90b-b875-43cd-bbfe-ffa75d320ebb@a30g2000vbt.googlegroups.com>
2010-11-14 15:43     ` Pascal J. Bourguignon
2010-11-14 20:24 ` Andreas Politz
2010-11-14 21:30 ` Felix E. Klee
2010-11-17  2:27 ` Stefan Monnier [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=jwvwrochemw.fsf-monnier+gnu.emacs.help@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --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.