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

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

Re: What's wrong with this seemingly simple function for unwrapping text


From: Endless Story
Subject: Re: What's wrong with this seemingly simple function for unwrapping text?
Date: 13 Jan 2007 04:18:33 -0800
User-agent: G2/1.0

Thanks to all. Via a quick Google I also found good recipes for
unfilling paragraph, region, or paragraphs with region, all by Sean
Burke at
http://interglacial.com/~sburke/pub/emacs/sburke_dot_emacs.config


B. T. Raven wrote:
> "Endless Story" <usable.thought@gmail.com> wrote in message
> 1168599607.154137.166990@q2g2000cwa.googlegroups.com">news:1168599607.154137.166990@q2g2000cwa.googlegroups.com...
> > I like autofill mode, but it has one disadvantage: the filled lines
> > require unfilling if I want to copy the text over into a Word
> > processor, e.g. Word or OpenOffice. This can be rather tedious, so I
> > thought I would write a simple function and put it in my .init file to
> > make everything easy:
> >
> > (defun unwrap-text ()
> >   (interactive)
> >   (setq fill-column 5000)
> >   (mark-whole-buffer)
> >   (fill-region)
> >   (setq fill-column '70)
> > )
> >
> > When the function gets to fill-region, it bombs out, complaining about
> > 'wrong number of variables.'  So my questions are:
> >
> > 1) For any lisp experts, what's going wrong here?
> > 2) Is there some built-in way for doing what I want to do?
> >
>
> Tassilo already fixed your problem but here are two more, in case you
> might not always want to affect the whole buffer:
>
> (defun unfill-paragraph ()   "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 ()   "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))))
> 
> Ed



reply via email to

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