[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Automate replace-regexp
From: |
Rodolfo Medina |
Subject: |
Re: Automate replace-regexp |
Date: |
Sun, 26 Aug 2018 04:40:56 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) |
Rodolfo Medina <rodolfo.medina@gmail.com> writes:
> Skip Montanaro <skip.montanaro@gmail.com> writes:
>
>> If it's a one-time thing, since replace-regexp is a command (uses
>> (interactive) to prompt for missing parameters), I'd just define a
>> macro with C-x (. From my edit-last-kbd-macro session (ugly, but only
>> took a moment to define):
>>
>> ESC
>> xreplace-regex ;; self-insert-command * 14
>> TAB ;; indent-for-tab-command
>> RET ;; newline
>> 2*\ ;; self-insert-command
>> bar ;; self-insert-command * 3
>> SPC ;; self-insert-command
>> %[0-9]+ ;; self-insert-command * 7
>> RET ;; newline
>> \ ;; self-insert-command
>> bar ;; self-insert-command * 3
>> RET ;; newline
>> ESC
>> xrepla ;; self-insert-command * 6
>> TAB ;; indent-for-tab-command
>> reg ;; self-insert-command * 3
>> TAB ;; indent-for-tab-command
>> RET ;; newline
>> 2*\ ;; self-insert-command
>> bar ;; self-insert-command * 3
>> RET ;; newline
>> \ ;; self-insert-command
>> bar ;; self-insert-command * 3
>> SPC ;; self-insert-command
>> %,(+ ;; self-insert-command * 4
>> SPC ;; self-insert-command
>> 2#) ;; self-insert-command * 3
>> RET ;; newline
>
> Thanks... But I had problem in defining such a kbd macro... Every time I
> try to insert `M-x query-replace-regexp ...' it would execute that command in
> the present buffer rather than simply register it as a kbd macro...
It seems it begins to work now...
Rodolfo