From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: David Kastrup Newsgroups: gmane.emacs.devel Subject: Re: query-replace-interactive Date: 07 Jul 2004 11:35:20 +0200 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: References: <876594drn6.fsf@mail.jurta.org> <87k6xjouj5.fsf@mail.jurta.org> <871xjp5uii.fsf@mail.jurta.org> <876590iepc.fsf@mail.jurta.org> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1089192978 21098 80.91.224.253 (7 Jul 2004 09:36:18 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 7 Jul 2004 09:36:18 +0000 (UTC) Cc: emacs-devel@gnu.org, rms@gnu.org, monnier@iro.umontreal.ca Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Wed Jul 07 11:36:08 2004 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1Bi8qW-00038x-00 for ; Wed, 07 Jul 2004 11:36:08 +0200 Original-Received: from lists.gnu.org ([199.232.76.165]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1Bi8qW-0005p3-00 for ; Wed, 07 Jul 2004 11:36:08 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1Bi8sZ-0004Kp-R2 for emacs-devel@quimby.gnus.org; Wed, 07 Jul 2004 05:38:15 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1Bi8sS-0004Kg-JN for emacs-devel@gnu.org; Wed, 07 Jul 2004 05:38:08 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1Bi8sR-0004KM-SO for emacs-devel@gnu.org; Wed, 07 Jul 2004 05:38:08 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1Bi8sR-0004KC-MO for emacs-devel@gnu.org; Wed, 07 Jul 2004 05:38:07 -0400 Original-Received: from [199.232.76.164] (helo=fencepost.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.34) id 1Bi8pu-0004Yq-LU for emacs-devel@gnu.org; Wed, 07 Jul 2004 05:35:30 -0400 Original-Received: from localhost ([127.0.0.1] helo=lola.goethe.zz) by fencepost.gnu.org with esmtp (Exim 4.34) id 1Bi8pn-0003wI-Hv; Wed, 07 Jul 2004 05:35:24 -0400 Original-To: Juri Linkov In-Reply-To: <876590iepc.fsf@mail.jurta.org> Original-Lines: 48 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:25521 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:25521 Juri Linkov writes: > Richard Stallman writes: > > I misunderstood the idea of "(default a->b)". Now that I see what > > it really does, I agree with you that it has lots of problems. > > > > Here's what I THOUGHT the idea was. > > > > The idea is that M-x query-replace would read just one minibuffer argument. > > That argument would have the form FROM->TO. After the arg is read, > > the interactive spec would split it apart at the -> to get the FROM > > and TO strings, and they would become the arguments in the call > > to query-replace. > > > > Further, the default for this one argument would be the previous > > argument to query-replace. The default would be used if you type RET > > and available to edit with M-n. > > > > This is radical, perhaps too radical, but it is clean and coherent. > > The original Stefan's idea was to display "(default a->b)" in the > prompt for the from-string and to interpret empty input of the > from-string as a request for repeating the last replacement. > > I extended this idea to what you described above, i.e. splitting the > from-string argument in the form "FROM -> TO". This would be more > consistent with standard Emacs handling of default values, but it has > one drawback: the separator should not appear in the text to replace. > But if the string " -> " is rare enough to appear in replacement strings > we could use it as a default separator and to allow to quote it (e.g. > " \-\> ") if someone really wants to use it in the from-string. You can't quote within a non-regexp replacement. One could place the "->" as an empty overlay in between and check its position after the entry has been done, that way you would not be able to edit it away and it would not be confused with -> in the text. But this is all academic for now. It does not belong in 21.4. And I also don't like getting possibly large and unrelated old replacements displayed in the prompt unless I explicitly ask for them. That's what the history is for. And there is no need for repeating a search after editing operations, anyway, since one can then just use the "edit" keybinding in query-replace-map for the editing. -- David Kastrup, Kriemhildstr. 15, 44793 Bochum