From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Paul Pogonyshev Newsgroups: gmane.emacs.devel Subject: Re: [patch] Re: regexp repacement, how to present replacement to user? Date: Sun, 28 Oct 2007 16:41:28 +0200 Message-ID: <200710281641.29296.pogonyshev@gmx.net> References: <200710131700.42100.pogonyshev@gmx.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1193581358 11884 80.91.229.12 (28 Oct 2007 14:22:38 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 28 Oct 2007 14:22:38 +0000 (UTC) Cc: juri@jurta.org, Stefan Monnier To: emacs-devel@gnu.org, rms@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Oct 28 15:22:40 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Im92F-0004yM-IL for ged-emacs-devel@m.gmane.org; Sun, 28 Oct 2007 15:22:39 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Im926-0003ow-9j for ged-emacs-devel@m.gmane.org; Sun, 28 Oct 2007 10:22:30 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Im91D-0003RY-58 for emacs-devel@gnu.org; Sun, 28 Oct 2007 10:21:35 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Im91C-0003RM-Eh for emacs-devel@gnu.org; Sun, 28 Oct 2007 10:21:34 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Im91C-0003RJ-9n for emacs-devel@gnu.org; Sun, 28 Oct 2007 10:21:34 -0400 Original-Received: from mail.gmx.net ([213.165.64.20]) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1Im91B-0002eZ-Rz for emacs-devel@gnu.org; Sun, 28 Oct 2007 10:21:34 -0400 Original-Received: (qmail invoked by alias); 28 Oct 2007 14:21:32 -0000 Original-Received: from unknown (EHLO [80.94.230.65]) [80.94.230.65] by mail.gmx.net (mp027) with SMTP; 28 Oct 2007 15:21:32 +0100 X-Authenticated: #16844820 X-Provags-ID: V01U2FsdGVkX1/npiEFuwDneh8oz0ojyMasRrJr8/yPiJ331/hgVk co8kc0y42Qh4hY User-Agent: KMail/1.7.2 In-Reply-To: Content-Disposition: inline X-Y-GMX-Trusted: 0 X-detected-kernel: by monty-python.gnu.org: Linux 2.6, seldom 2.4 (older, 4) 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: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:81956 Archived-At: Richard Stallman wrote: > I think the main part of it is the offsetting and that may be used at > other places. So it's the only part we want to provide. > > The originally proposed function was much cleaner and easier to use > than this offsetting function. If this facility is useful enough to > justify adding someting to Emacs, better to add the originally > proposed function. > > The question is whether this is useful enough to be a reason to add > anything. Sorry for long delay. How about this addition using new function right inside Emacs. In `query-replace-regexp', hitting `t' (or anything else, doesn't matter) will toggle between Query replacing REGEXP with REPLACEMENT: (C-h for help) and Replace REGEXP with SUBSTITUTED-REPLACEMENT? (C-h for help) This way you can preview replacement result, which can be useful if your replacement string is complicated enough. E.g. you will be able to toggle between Query replacing \([a-z]+\) \([a-z]+\) with \1 \2 \1: (C-h for help) and Replace \([a-z]+\) \([a-z]+\) with foo bar foo? (C-h for help) Optionally we can also toggle to `Replace MATCH...' instead of `Replace REGEXP...', but that is probably not very useful given that the match is highlighted in the buffer anyway. Paul