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

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

Re: Reformatting Chat Protocol?


From: Stefan Monnier
Subject: Re: Reformatting Chat Protocol?
Date: Wed, 08 Dec 2010 15:36:24 -0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

> 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


reply via email to

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