From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tom Newsgroups: gmane.emacs.devel Subject: Re: History for query replace pairs Date: Mon, 11 Aug 2014 20:34:33 +0200 Message-ID: References: <87a97ejxuo.fsf@mail.jurta.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary=001a11c202ce6fda4f05005eceaf X-Trace: ger.gmane.org 1407782088 30302 80.91.229.3 (11 Aug 2014 18:34:48 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 11 Aug 2014 18:34:48 +0000 (UTC) Cc: Juri Linkov , emacs-devel To: Josh Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Aug 11 20:34:41 2014 Return-path: Envelope-to: ged-emacs-devel@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 1XGuQa-00045M-5q for ged-emacs-devel@m.gmane.org; Mon, 11 Aug 2014 20:34:40 +0200 Original-Received: from localhost ([::1]:37518 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XGuQZ-0002xx-Ky for ged-emacs-devel@m.gmane.org; Mon, 11 Aug 2014 14:34:39 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45742) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XGuQV-0002xo-T3 for emacs-devel@gnu.org; Mon, 11 Aug 2014 14:34:36 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XGuQU-0002If-PU for emacs-devel@gnu.org; Mon, 11 Aug 2014 14:34:35 -0400 Original-Received: from mail-yh0-x231.google.com ([2607:f8b0:4002:c01::231]:47939) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XGuQU-0002Ia-K7 for emacs-devel@gnu.org; Mon, 11 Aug 2014 14:34:34 -0400 Original-Received: by mail-yh0-f49.google.com with SMTP id b6so6590444yha.36 for ; Mon, 11 Aug 2014 11:34:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=axpKfYn6jnumRWRpuXotm7WQ5Zl6RTrx/imqVoExn70=; b=qdJWkd3VsvJio0kGn3UH8YsCcuzXNp36GyMeZDqFd5F7q7rj+fBWIgbn2eYrz8N9nF m0ZYD0ril7H/PoVQmV4w8gkcftIKBdPVCF5ProHGwwwyysXgmqm/Y/Bi1962BGH1bnxa +0uPSFEZhHinU1rdhPtEC9P+4S0gbjLjSY//Oy3ieMYEZK6MZrNdtYJJfrH1gZucCGaV HufvVhEyHr6CAhyHLf14avnqbhW4XlC9XabxNfqx/uL0Ry33N9CpqVIM7vXrZThVeEbn sHYB2Q/JGSPOn6qsQPcZfUyMFIFRLx8ud0viKoVZf3Cb4fSo057wiWXdlK4u51uuJS/P TYYQ== X-Received: by 10.236.50.198 with SMTP id z46mr45021030yhb.115.1407782073909; Mon, 11 Aug 2014 11:34:33 -0700 (PDT) Original-Received: by 10.170.49.207 with HTTP; Mon, 11 Aug 2014 11:34:33 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:4002:c01::231 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:173577 Archived-At: --001a11c202ce6fda4f05005eceaf Content-Type: multipart/alternative; boundary=001a11c202ce6fda4b05005ecead --001a11c202ce6fda4b05005ecead Content-Type: text/plain; charset=UTF-8 On Sun, Aug 10, 2014 at 7:59 AM, Tom wrote: > > > Yes, that would be the full realization of the idea. > Being able to select from FROM -> TO history pairs and quickly edit > them in-place if needed. > > So the current FROM input field should provide access to previous > FROM -> TO pairs and handle the case when such a pair is > inputted instead of a simple FROM string. > > I created a quick proof of concept implementation. It changes the behavior of the arrow keys for the query-replace(-regexp) FROM prompt. You can stll access the original behavior with M-p/n. So when you start a query-replace and press the up arrow then search/replace history is rendered as FROM -> TO pairs. The -> marker is highlighted and intangible, the cursor jumps over it and you are free to edit the search/replace string. If you submit a FROM->TO pair from the FROM input field with RET then the replacement is started immediately. If you submit a simple string (without the marker) then it behaves as usual and asks for a TO string. See the attached file. --001a11c202ce6fda4b05005ecead Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable



On Sun, Aug 10, 2014 at 7:59 AM, Tom <adatgyujto@gmail.com= > wrote:


Ye= s, that would be the full realization of the idea.=C2=A0
Being able to select from FROM -> TO history pairs and quickly edit=
them in-place if =C2=A0needed.

So the current FROM input field should provide access to =C2=A0p= revious
FROM -> TO pairs and handle the case when such a p= air is
inputted instead of a simple FROM string.


I created a quick p= roof of concept implementation. It changes the behavior of the arrow keys f= or the query-replace(-regexp) FROM prompt. You can stll access the original= behavior with M-p/n.

So when you= start a query-replace and press the up arrow then search/replace history i= s rendered as FROM -> TO pairs. =C2=A0The -> marker is highlighted an= d intangible, the cursor jumps over it and you are free to edit the search/= replace string. If you submit a FROM->TO pair from the FROM input field = with RET then the replacement is started immediately. If you submit a simpl= e string (without the marker) then it behaves as usual and asks for a TO st= ring.

See the att= ached file.

--001a11c202ce6fda4b05005ecead-- --001a11c202ce6fda4f05005eceaf Content-Type: application/octet-stream; name="hist.el" Content-Disposition: attachment; filename="hist.el" Content-Transfer-Encoding: base64 X-Attachment-Id: f_hyq507110 KGRlZnZhciBoaXN0cGFpcnMtaGlzdG9yeSBuaWwpDQoNCihkZWZ2YXIgaGlzdHBhaXJzLWhpc3Rv cnktY3VycmVudCBuaWwpDQoNCg0KKGRlZnVuIGhpc3RwYWlycy1xdWVyeS1yZXBsYWNlLXAgKCkN CiAgKHN0cmluZy1tYXRjaCAiUXVlcnkgcmVwbGFjZVxcKCByZWdleHBcXCk/XFwoIChcXHw6XFwp IiAobWluaWJ1ZmZlci1wcm9tcHQpKSkNCg0KDQooZGVmdW4gaGlzdHBhaXJzLXVwZGF0ZS1oaXN0 b3J5LWlmLW5lY2Vzc2FyeSAoKQ0KICAodW5sZXNzIChlcSAoY2RyIGhpc3RwYWlycy1oaXN0b3J5 KSBjb21tYW5kLWhpc3RvcnkpDQogICAgKHNldHEgaGlzdHBhaXJzLWhpc3RvcnkNCiAgICAgICAg ICAoY29ucyANCiAgICAgICAgICAgKGRlbGV0ZS1pZiAnbnVsbCANCiAgICAgICAgICAgICAgICAg ICAgICAobWFwY2FyDQogICAgICAgICAgICAgICAgICAgICAgIChsYW1iZGEgKGl0ZW0pDQogICAg ICAgICAgICAgICAgICAgICAgICAgKGlmIChvciAoZXEgKGNhciBpdGVtKSAncXVlcnktcmVwbGFj ZSkNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChlcSAoY2FyIGl0ZW0pICdxdWVy eS1yZXBsYWNlLXJlZ2V4cCkpDQogICAgICAgICAgICAgICAgICAgICAgICAgICAgIChjb25zIChz ZWNvbmQgaXRlbSkgKHRoaXJkIGl0ZW0pKSkpDQogICAgICAgICAgICAgICAgICAgICAgIGNvbW1h bmQtaGlzdG9yeSkpDQogICAgICAgICAgIGNvbW1hbmQtaGlzdG9yeSkpKSkNCg0KDQooZGVmdW4g aGlzdHBhaXJzLXVwZGF0ZS1taW5pYnVmZmVyICgpDQogIChkZWxldGUtbWluaWJ1ZmZlci1jb250 ZW50cykNCiAgKGluc2VydCAoY2FhciBoaXN0cGFpcnMtaGlzdG9yeS1jdXJyZW50KQ0KICAgICAg ICAgIChwcm9wZXJ0aXplICIgLT4gIiAnZmFjZSAnaGlnaGxpZ2h0IA0KICAgICAgICAgICAgICAg ICAg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1ZmZl ci1jb250ZW50cykpKSkNCiAgICAgIChpZiAobm90IHBvcykNCiAgICAgICAgICAoZXhpdC1taW5p YnVmZmVyKSAgOzsgbm9ybWFsIGV4ZWN1dGlvbg0KICAgICAgICANCiAgICAgICAgKGlmIChnZXQt dGV4dC1wcm9wZXJ0eSAwICdpbnRhbmdpYmxlIChtaW5pYnVmZmVyLWNvbnRlbnRzKSkNCiAgICAg ICAgICAgIChtZXNzYWdlICJGUk9NIGlzIGVtcHR5LiIpDQoNCiAgICAgICAgICAobGV0KiAoKGVu ZCAobmV4dC1zaW5nbGUtcHJvcGVydHktY2hhbmdlIHBvcyAnaW50YW5naWJsZQ0KICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKG1pbmlidWZmZXItY29u dGVudHMpKSkNCiAgICAgICAgICAgICAgICAgKGZyb20gKHN1YnN0cmluZyAobWluaWJ1ZmZlci1j b250ZW50cykgMCBwb3MpKQ0KICAgICAgICAgICAgICAgICAodG8gKGlmIGVuZA0KICAgICAgICAg ICAgICAgICAgICAgICAgIChzdWJzdHJpbmcgKG1pbmlidWZmZXItY29udGVudHMpIGVuZCkNCiAg ICAgICAgICAgICAgICAgICAgICAgIiIpKSkNCiAgICAgICAgICAgIChkZWxldGUtbWluaWJ1ZmZl ci1jb250ZW50cykNCiAgICAgICAgICAgIChpbnNlcnQgZnJvbSkNCg0KICAgICAgICAgICAgKHB1 c2ggJ3JldHVybiB1bnJlYWQtY29tbWFuZC1ldmVudHMpDQogICAgICAgICAgICAoZG9saXN0IChj IChucmV2ZXJzZSAoc3RyaW5nLXRvLWxpc3QgdG8pKSkNCiAgICAgICAgICAgICAgKHB1c2ggYyB1 bnJlYWQtY29tbWFuZC1ldmVudHMpKQ0KDQogICAgICAgICAgICAoZXhpdC1taW5pYnVmZmVyKSkp KSkpKQ0KDQoNCg0KKGRlZmluZS1rZXkgbWluaWJ1ZmZlci1sb2NhbC1tYXANCiAgKGtiZCAiPHVw PiIpICdoaXN0cGFpcnMtcHJldmlvdXMtaGlzdG9yeS1lbGVtZW50KQ0KKGRlZmluZS1rZXkgbWlu aWJ1ZmZlci1sb2NhbC1tYXANCiAgKGtiZCAiPGRvd24+IikgJ2hpc3RwYWlycy1uZXh0LWhpc3Rv cnktZWxlbWVudCkNCihkZWZpbmUta2V5IG1pbmlidWZmZXItbG9jYWwtbWFwDQogIChrYmQgIjxy ZXR1cm4+IikgJ2hpc3RwYWlycy1maW5pc2gpDQo= --001a11c202ce6fda4f05005eceaf--