help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Custom query-replace.


From: Marcin Borkowski
Subject: Re: Custom query-replace.
Date: Mon, 13 Jul 2015 12:55:52 +0200

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 via email to

[Prev in Thread] Current Thread [Next in Thread]