From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Marcin Borkowski Newsgroups: gmane.emacs.help Subject: Re: Custom query-replace. Date: Mon, 13 Jul 2015 12:55:52 +0200 Message-ID: <87fv4sba2v.fsf@mbork.pl> References: <87y4ilnlvn.fsf@BanjaLuka.rclayton.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1436784995 22258 80.91.229.3 (13 Jul 2015 10:56:35 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 13 Jul 2015 10:56:35 +0000 (UTC) To: "R. Clayton" , "help-gnu-emacs\@gnu.org" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Jul 13 12:56:22 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZEbPK-0002y6-Gm for geh-help-gnu-emacs@m.gmane.org; Mon, 13 Jul 2015 12:56:22 +0200 Original-Received: from localhost ([::1]:54033 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZEbPJ-000692-Pa for geh-help-gnu-emacs@m.gmane.org; Mon, 13 Jul 2015 06:56:21 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45970) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZEbP6-00068q-Ng for help-gnu-emacs@gnu.org; Mon, 13 Jul 2015 06:56:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZEbP2-0003Lf-L1 for help-gnu-emacs@gnu.org; Mon, 13 Jul 2015 06:56:08 -0400 Original-Received: from mail.mojserwer.eu ([2a01:5e00:2:52::8]:54484) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZEbP2-0003KV-EU for help-gnu-emacs@gnu.org; Mon, 13 Jul 2015 06:56:04 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by mail.mojserwer.eu (Postfix) with ESMTP id F36854F607E; Mon, 13 Jul 2015 12:56:02 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mail.mojserwer.eu Original-Received: from mail.mojserwer.eu ([127.0.0.1]) by localhost (mail.mojserwer.eu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id NhIlGj-GHUzo; Mon, 13 Jul 2015 12:55:58 +0200 (CEST) Original-Received: from localhost (unknown [109.232.24.146]) by mail.mojserwer.eu (Postfix) with ESMTPSA id 5981B4F607B; Mon, 13 Jul 2015 12:55:58 +0200 (CEST) In-reply-to: X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a01:5e00:2:52::8 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:105677 Archived-At: On 2015-07-13, at 09:19, Yuri Khan 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 =E2=80=9Cq=E2=80=9D) 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, --=20 Marcin Borkowski http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski Faculty of Mathematics and Computer Science Adam Mickiewicz University