all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Sam Peterson <skpeterson@nospam.please.ucdavis.edu>
To: help-gnu-emacs@gnu.org
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	[thread overview]
Message-ID: <m1hcrrupll.fsf@Sams-Baby.local> (raw)
In-Reply-To: ev8lno$p4e$1@panix2.panix.com

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 <RET> 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/<vi-command>/"  
> 
>   (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

  reply	other threads:[~2007-04-08 10:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-07 17:51 #1: How to do vi's 'g/foo/s/x/y/' #2: + with a Q-R "yes/no?" David Combs
2007-04-08 10:28 ` Sam Peterson [this message]
2007-04-08 18:48   ` Markus Triska
2007-04-08 19:07 ` Peter Dyballa
2007-04-09  7:48 ` Drew Adams
     [not found] <mailman.1852.1176105200.7795.help-gnu-emacs@gnu.org>
2007-04-23  3:32 ` David Combs

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

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

  git send-email \
    --in-reply-to=m1hcrrupll.fsf@Sams-Baby.local \
    --to=skpeterson@nospam.please.ucdavis.edu \
    --cc=help-gnu-emacs@gnu.org \
    /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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.