help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Search and replace in a macro between emacs session


From: Xah Lee
Subject: Re: Search and replace in a macro between emacs session
Date: Wed, 08 Dec 2010 15:17:41 -0000
User-agent: G2/1.0

On Jul 5, 8:56 pm, Jobst Schmalenbach <jo...@barrett.com.au> wrote:
> Hi.
>
> I need to replace $PHP_SELF with $_SESSION['PHP_SELF'].
> Problem is that in some cases it needs to be ".$_SESSION['PHP_SELF'].", in
> others $_SESSION['PHP_SELF']. This is across a variety of files, directories.
>
> Reason for all of this is the move from 5.1 to 5.3 php. So I have some
> other "things" that need to be changed as well , and I would like to use
> different macros, but with a query-replace or query-replace-regexp.
>
> I tried to write a keyboard macro and/or bind this to a key and load this in
> the .emacs file using query-replace ....
>
> Now I did some reading and figured out that the macro seems to stop after the
> search, I followed some of the suggestion, e.g. use of C-x-q etc, but it 
> stops.
>
> How can I do this?
>
> I guess I could save the minibuffer between session and then call m-% and
> scroll to the correct substitution but there has to be a better way?
>
> Jobst

hi, i kinda see what you needed to do, but it's not clear to me though
exactly what you wanted to do, or how the key macros and minibuffer
comes to play.

here's what i do that maybe is relevant.

I often need to find/replace multiple pairs, on a case by case basis,
in a dir and all its sub dirs.

e.g. replace these pairs

Alice → Mary
John → David
...

but on a case by case basis. i.e. i need to look at the text before i
say yes or no.

Usually what i do is just use dired-do-query-replace-regexp (press Q
in dired) for each pair.

i don't see you mention dired-do-query-replace-regexp so perhaps
that's the command you need? Here's a tutorial for that

• Interactively Find and Replace String Patterns on Multiple Files
  http://xahlee.org/emacs/find_replace_inter.html

i'll write a command that's similar to dired-do-query-replace-regexp
but for multiple pairs... never got to it. I remember a year or 2 ago
someone has posted code that does.

  Xah
∑ http://xahlee.org/

reply via email to

[Prev in Thread] Current Thread [Next in Thread]