unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Rodolfo Medina <rodolfo.medina@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Automate replace-regexp
Date: Sun, 26 Aug 2018 04:40:56 +0200	[thread overview]
Message-ID: <875zzxq287.fsf@gmail.com> (raw)
In-Reply-To: 87d0u5q3ds.fsf@gmail.com

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




  reply	other threads:[~2018-08-26  2:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-25 15:19 Automate replace-regexp Rodolfo Medina
2018-08-25 16:04 ` Skip Montanaro
2018-08-26  2:15   ` Rodolfo Medina
2018-08-26  2:40     ` Rodolfo Medina [this message]
2018-08-26  4:01     ` Rodolfo Medina

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=875zzxq287.fsf@gmail.com \
    --to=rodolfo.medina@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).