From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Sam Peterson Newsgroups: gmane.emacs.help Subject: Re: #1: How to do vi's 'g/foo/s/x/y/' #2: + with a Q-R "yes/no?" Date: 08 Apr 2007 03:28:54 -0700 Organization: University of California, Davis Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1176028691 12623 80.91.229.12 (8 Apr 2007 10:38:11 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 8 Apr 2007 10:38:11 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Apr 08 12:37:24 2007 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1HaUls-00019n-Id for geh-help-gnu-emacs@m.gmane.org; Sun, 08 Apr 2007 12:37:20 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HaUpZ-0005d4-Gl for geh-help-gnu-emacs@m.gmane.org; Sun, 08 Apr 2007 06:41:09 -0400 Original-Path: shelby.stanford.edu!newshub.stanford.edu!newsfeed.berkeley.edu!ucberkeley!ihnp4.UCSD.Edu!ucdavis!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 32 Original-NNTP-Posting-Host: c-76-20-39-205.hsd1.ca.comcast.net Original-X-Trace: skeeter.ucdavis.edu 1176028128 8539 76.20.39.205 (8 Apr 2007 10:28:48 GMT) Original-X-Complaints-To: usenet@ucdavis.edu Original-NNTP-Posting-Date: Sun, 8 Apr 2007 10:28:48 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/22.0.50 Original-Xref: shelby.stanford.edu gnu.emacs.help:146877 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:42481 Archived-At: dkcombs@panix.com (David Combs) on 7 Apr 2007 13:51:52 -0400 didst step forth and proclaim thus: > (1) How to do, in gnu-emacs, vi's 'g/foo/s/x/y/': > > That is, "on all lines that contain regexp "foo", change x to y. > > And maybe also with option: only the first one on that line, or all of them? Good question. There's no quick equivalent to my knowledge. Though there are probably a few ways to implement it. The best method would be to write some lisp code as I thought about how to do it with a macro and it started getting too complicated. M-x occur is definitely worth looking into. > (2) Same as above, BUT WITH A QUERY-REPLACE-LIKE "YES|NO|!|etc" prompt. > > (No, I believe that vi-emulator .el-package does NOT implement > vi's "g/pat//" > > (Sure would be nice if it did!) What are you talking about? There's three different vi emulators in Emacs. I tried the above command in both vip and viper and it worked perfectly. -- Sam Peterson skpeterson At nospam ucdavis.edu "if programmers were paid to remove code instead of adding it, software would be much better" -- unknown