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

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

Re: regexp to collapse multiple blank lines into one


From: B. T. Raven
Subject: Re: regexp to collapse multiple blank lines into one
Date: Sun, 09 Oct 2005 18:36:53 GMT

"Neon Absentius" <absent@sdf.lonestar.org> wrote in message
news:mailman.10556.1128865819.20277.help-gnu-emacs@gnu.org...
> On Sun, Oct 09, 2005 at 12:27:07PM +0000, B. T. Raven wrote:
> > Is there a way to use M-C-% to flush extra blank lines from a
buffer.
> > Something like:
> > Query replace regexp:  ^$+ [which of course doesn't work, presumably
> > because $ has to be last]
> > with:      C-j
> >
>
> The following seems to work
>
> C-M-% \(^C-qC-j\)+ RET \1 RET
>
> Provided of course that your lines are really blank and do not contain
> any spaces, tabs etc.
>
> > Thanks,
> >
> > Ed
> >
>
> --
>  There is no national science just as there is no national
> multiplication table; what is national is no longer science.
>          -- Anton Checov

Thanks F.L., P.D., N.A. Neon's solution seems the easiest to me. I need
this only because I can't get control chars into the replacement string.
The replacement can be a bare RET but you can't replace with less than
nothing, i.e. replacing a regexp with nothing and then backspacing to
get rid of the blank line.  Could this be related to the fact that
C-<spacebar> is no longer bound to 'set-mark'? It used to be, but now
C-h k reports nothing, (in fact, doesn't react at all) to that keypress.

Ed, child of four.



reply via email to

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