From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "B. T. Raven" Newsgroups: gmane.emacs.help Subject: Re: regexp to collapse multiple blank lines into one Date: Sun, 09 Oct 2005 18:36:53 GMT Organization: EarthLink Inc. -- http://www.EarthLink.net Message-ID: <9rd2f.11472$vw6.9111@newsread1.news.atl.earthlink.net> References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1128883391 11873 80.91.229.2 (9 Oct 2005 18:43:11 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 9 Oct 2005 18:43:11 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Oct 09 20:42:59 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EOg6g-0004vf-8S for geh-help-gnu-emacs@m.gmane.org; Sun, 09 Oct 2005 20:41:10 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EOg6f-0001cN-HJ for geh-help-gnu-emacs@m.gmane.org; Sun, 09 Oct 2005 14:41:09 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!headwall.stanford.edu!newshub.sdsu.edu!elnk-nf2-pas!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!stamper.news.atl.earthlink.net!newsread1.news.atl.earthlink.net.POSTED!0847253b!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 39 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 Original-NNTP-Posting-Host: 4.158.222.250 Original-X-Complaints-To: abuse@earthlink.net Original-X-Trace: newsread1.news.atl.earthlink.net 1128883013 4.158.222.250 (Sun, 09 Oct 2005 11:36:53 PDT) Original-NNTP-Posting-Date: Sun, 09 Oct 2005 11:36:53 PDT Original-Xref: shelby.stanford.edu gnu.emacs.help:134505 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:30083 Archived-At: "Neon Absentius" 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- 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.