unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: "B. T. Raven" <ecinmn@peoplepc.com>
Subject: Re: regexp to collapse multiple blank lines into one
Date: Sun, 09 Oct 2005 18:36:53 GMT	[thread overview]
Message-ID: <9rd2f.11472$vw6.9111@newsread1.news.atl.earthlink.net> (raw)
In-Reply-To: mailman.10556.1128865819.20277.help-gnu-emacs@gnu.org


"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.

  parent reply	other threads:[~2005-10-09 18:36 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-09 12:27 repexp to collapse multiple blank lines into one B. T. Raven
2005-10-09 12:59 ` Friedrich Laher
2005-10-09 13:01 ` Peter Dyballa
2005-10-09 13:44 ` Neon Absentius
     [not found] ` <mailman.10556.1128865819.20277.help-gnu-emacs@gnu.org>
2005-10-09 18:36   ` B. T. Raven [this message]
2005-10-10 16:35     ` regexp " Kevin Rodgers
2005-10-10 17:28       ` Neon Absentius
2005-10-10 18:33         ` Kevin Rodgers
2005-10-10 19:06           ` Neon Absentius
     [not found]           ` <mailman.10719.1128971211.20277.help-gnu-emacs@gnu.org>
2005-10-11 22:21             ` Tim X
2005-10-12  1:14               ` Neon Absentius
2005-10-10 18:02       ` Peter Dyballa
2005-10-10 20:59 ` repexp " David Hansen
2005-10-11  2:09   ` Neon Absentius

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='9rd2f.11472$vw6.9111@newsread1.news.atl.earthlink.net' \
    --to=ecinmn@peoplepc.com \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).