From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Deniz Dogan Newsgroups: gmane.emacs.help Subject: Re: Emacs equivalent of the ":g" command in vi Date: Fri, 22 Jul 2011 12:45:14 +0200 Message-ID: <4E2954BA.7040800@dogan.se> References: <14F21CEC-7265-4DE4-888A-A10FCFFF6826@Web.DE> <8762mufxx7.fsf@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1311331537 16475 80.91.229.12 (22 Jul 2011 10:45:37 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 22 Jul 2011 10:45:37 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Jul 22 12:45:33 2011 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QkDEb-0005V9-Ao for geh-help-gnu-emacs@m.gmane.org; Fri, 22 Jul 2011 12:45:33 +0200 Original-Received: from localhost ([::1]:36399 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QkDEa-0007Yp-RL for geh-help-gnu-emacs@m.gmane.org; Fri, 22 Jul 2011 06:45:32 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:54204) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QkDEX-0007Yk-EE for help-gnu-emacs@gnu.org; Fri, 22 Jul 2011 06:45:30 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QkDEW-0007Xa-4T for help-gnu-emacs@gnu.org; Fri, 22 Jul 2011 06:45:29 -0400 Original-Received: from ch-smtp04.sth.basefarm.net ([80.76.153.5]:60617) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QkDEV-0007XU-Um for help-gnu-emacs@gnu.org; Fri, 22 Jul 2011 06:45:28 -0400 Original-Received: from c80-216-105-155.bredband.comhem.se ([80.216.105.155]:54416 helo=[192.168.0.10]) by ch-smtp04.sth.basefarm.net with esmtp (Exim 4.76) (envelope-from ) id 1QkDES-0005eX-EG for help-gnu-emacs@gnu.org; Fri, 22 Jul 2011 12:45:26 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0) Gecko/20110624 Thunderbird/5.0 In-Reply-To: X-Originating-IP: 80.216.105.155 X-Scan-Result: No virus found in message 1QkDES-0005eX-EG. X-Scan-Signature: ch-smtp04.sth.basefarm.net 1QkDES-0005eX-EG 6deedf017d5fa990a7f4ee281931a689 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.76.153.5 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:81730 Archived-At: On 2011-07-22 12:02, C K Kashyap wrote: > > which could be as simple as in vi/vim.) > I think he want to delete lines matching a regexp, so C-k is not what he > wants here. > > `query-replace-regexp' can be used with a regexp like this: > > ^.*\(your_regexp\).*$ > > and you replace with nothing (empty prompt). > > -- > > > replace-regexp is indeed closer to what I am looking for. However, I'd > like the result to not leave blank lines. > > Regards, > Kashyap First, either move to the start of where you want to search OR make an active region (select) the parts where you want it to take effect. M-< goes to the beginning of the buffer and C-x h marks the whole buffer, FYI. Now, M-x delete-matching-lines RET your_regexp RET Deniz