Re: Question about writing a macro in XEMACS
[email protected] Fri, 7 Jul 2006 11:35:24 -0400
| Newsgroups | gmane.emacs.xemacs.general |
|---|---|
| Message-ID | <OF1C10FACE.01B41408-ON852571A4.0054F8A6-852571A4.0055A390@iqfinancial.com> |
Try something like this (I recorded it from emacs, but should be same).
Command: last-kbd-macro
Key: none
Macro:
C-s ;; isearch-forward
abc ;; self-insert-command * 3
RET ;; newline
3*DEL ;; c-electric-backspace
cde ;; self-insert-command * 3
C-x r i ;; insert-register
q ;; self-insert-command
C-x r + ;; increment-register
q ;; self-insert-command
I also set F4 to last keyboard macro (I exec macros way too often for the
default c-x,e to be a good choice).
In the example above, I used "register q" as the number register.
You have to init register q, such as to zero. You can use: `C-x r n q'.
abc abc abc
changes to
cde1 cde2 cde3
=
=20
Mohsen Owzar =
=20
<mohsen.owzar@phi =
=20
lips.com> T=
o=20
Sent by: [email protected] =
=20
xemacs-news-bounc c=
c=20
[email protected] =
=20
Subjec=
t=20
Question about writing a macro in =
=20
07/07/2006 09:24 XEMACS =
=20
AM =
=20
=
=20
=
=20
=
=20
=
=20
=
=20
Dear all,
I do not know if I'm writing this question to the correct address or not?
If not please let me know to where I have to write next time, if I have
questions belonging to XEMACS, because I'm new in this group.
And now my question:
I use often the macro feature in XEMACS. If I want to do some actions wit=
h
some replacements (e.g. "abc" with "cde") in a text file, I do it once an=
d
save it in a macro and rerun it by using the "excecute-last-kbd-macro" li=
ne
by line through the whole file.
If the replacements are always the same, my macro works fine. But if I
want to replace the sting "abc" with "cde1", "cde2", "cde3" ..., which
means
that each time the replacement is increased by a certain value, in this
case
one, how can I write my macro to achieve this replacement by using the
command
"excecute-last-kbd-macro"?
Best regards
Mohsen Owzar
=1F=1F=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Mohsen Owzar
Design Engineer
Business Line Cordless & MultiMedia
Philips AG, Binzstrasse 44
CH-8045 Z=FCrich
TEL: +41 44 465 12 68
FAX: +41 44 465 18 05
E-mail: [email protected]