all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Re: Search and replace in a macro between emacs session
       [not found] <4c32a974$0$14142$c3e8da3@news.astraweb.com>
@ 2010-07-07 14:59 ` Xah Lee
  0 siblings, 0 replies; only message in thread
From: Xah Lee @ 2010-07-07 14:59 UTC (permalink / raw)
  To: help-gnu-emacs

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/^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-07-07 14:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <4c32a974$0$14142$c3e8da3@news.astraweb.com>
2010-07-07 14:59 ` Search and replace in a macro between emacs session Xah Lee

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.