[Gllug] Emacs macro to do a replace-regexp

J F jnns at linuxmail.org
Mon Feb 13 11:02:44 UTC 2006


Hello

I'm new to Emacs and I'm trying to set up a quick way of doing a search & replace for a word beginning with &# and ending with a semi-colon (ie an HTML entity) in Emacs. But I want to be asked everytime whether the search string should be deleted or replaced with something else.

I tried to set up a keyboard macro for the command replace-regexp, searching for '\&\#[^;];' (without the quotes). I stopped recording it when it asks what it should be replaced with, but this didn't work... when running the keyboard macro it goes ahead and replaces everything without asking. This is the macro in my .emacs:

(fset 'findentities
   [?\M-x ?r ?e ?p ?l ?a ?c ?e ?- ?r ?e ?g ?e ?x ?p return ?\\ ?& ?\\ ?# ?[ ?^ ?\; ?] ?* ?\;])

Is there a way of running this keyboard macro interactively, where it asks what the search string should be replace with? Or should I look into LISP?

Thanks

-- 
_______________________________________________
Check out the latest SMS services @ http://www.linuxmail.org
This allows you to send and receive SMS through your mailbox.

Powered by Outblaze
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list