all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Marcin Borkowski <mbork@mbork.pl>
To: "R. Clayton" <rvclayton@acm.org>,
	"help-gnu-emacs\@gnu.org" <help-gnu-emacs@gnu.org>
Subject: Re: Custom query-replace.
Date: Mon, 13 Jul 2015 12:55:52 +0200	[thread overview]
Message-ID: <87fv4sba2v.fsf@mbork.pl> (raw)
In-Reply-To: <CAP_d_8V4esgz+duk2xRfOvA+hb=wp1VXQGLPvxWCdG7oX=jQeQ@mail.gmail.com>


On 2015-07-13, at 09:19, Yuri Khan <yuri.v.khan@gmail.com> wrote:

> Possible further improvement: If you encounter this task frequently
> and the need for other edits is low, you might want to make it a minor
> mode that (1) primes the loop on entry; (2) binds super-easy
> (basically, single-character) keys; (3) binds another super-easy key
> (such as “q”) to disable the mode.

I sent a PM to the OP with (more or less) this, which I made for my own
use some time ago.  (I did not want to send that code to the list -- it
is not really polished at all.)  If there is any interest, I might try
to improve and/or rewrite and publish it.

Basically, it is a mode and a function (modeled on Isearch) which, given
a list whose elements are lists with a regex as the car and a list of
possible replacements as the cdr, walk through the buffer, finding
subsequent matches for any of these regexen and allowing to cycle
through the given possible replacements with TAB.  It's not very well
written - I wrote it several years ago, when my Elisp-fu was weaker -
but works.

Best,

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University



  reply	other threads:[~2015-07-13 10:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-12 20:47 Custom query-replace R. Clayton
2015-07-13  7:19 ` Yuri Khan
2015-07-13 10:55   ` Marcin Borkowski [this message]
2015-07-14 17:32   ` R. Clayton

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

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

  git send-email \
    --in-reply-to=87fv4sba2v.fsf@mbork.pl \
    --to=mbork@mbork.pl \
    --cc=help-gnu-emacs@gnu.org \
    --cc=rvclayton@acm.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.
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.