From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.devel Subject: RE: should query-replace-regexp-eval be in the manual? Date: Sun, 15 Apr 2007 15:54:58 -0700 Message-ID: References: <85ejmlwbd8.fsf@lola.goethe.zz> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1176677759 6082 80.91.229.12 (15 Apr 2007 22:55:59 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 15 Apr 2007 22:55:59 +0000 (UTC) To: "Emacs-Devel" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Apr 16 00:55:53 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 1HdDdR-0008PV-IE for ged-emacs-devel@m.gmane.org; Mon, 16 Apr 2007 00:55:53 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HdDhy-0006Kg-Hj for ged-emacs-devel@m.gmane.org; Sun, 15 Apr 2007 19:00:34 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HdDhv-0006IE-N3 for emacs-devel@gnu.org; Sun, 15 Apr 2007 19:00:31 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HdDhu-0006Fb-B0 for emacs-devel@gnu.org; Sun, 15 Apr 2007 19:00:30 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HdDhu-0006FI-7k for emacs-devel@gnu.org; Sun, 15 Apr 2007 19:00:30 -0400 Original-Received: from agminet01.oracle.com ([141.146.126.228]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1HdDdL-0005RB-Sy for emacs-devel@gnu.org; Sun, 15 Apr 2007 18:55:48 -0400 Original-Received: from rgmgw3.us.oracle.com (rgmgw3.us.oracle.com [138.1.186.112]) by agminet01.oracle.com (Switch-3.2.4/Switch-3.1.7) with ESMTP id l3FMti23019033 for ; Sun, 15 Apr 2007 17:55:44 -0500 Original-Received: from acsmt351.oracle.com (acsmt351.oracle.com [141.146.40.151]) by rgmgw3.us.oracle.com (Switch-3.2.4/Switch-3.1.7) with ESMTP id l3FB4SfS031752 for ; Sun, 15 Apr 2007 16:55:43 -0600 Original-Received: from dhcp-amer-whq-csvpn-gw3-141-144-81-24.vpn.oracle.com by acsmt350.oracle.com with ESMTP id 2616943921176677713; Sun, 15 Apr 2007 15:55:13 -0700 X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.6604 (9.0.2911.0) In-Reply-To: <85ejmlwbd8.fsf@lola.goethe.zz> Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3028 X-Whitelist: TRUE X-Whitelist: TRUE X-Brightmail-Tracker: AAAAAQAAAAI= X-detected-kernel: Linux 2.4-2.6 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:69475 Archived-At: > > For those who are familiar with this command and with using `\,' with > > `query-replace-regexp': Could you compare/contrast these two in > > terms of use cases? > > query-replace-regexp-eval can do nothing that one can't achieve with a > use of a \, expression in query-replace-regexp. > > In contrast to query-replace-regexp-eval, \, does not necessitate > deciding in advance that you are going to need Lisp for a job, and > you'll only need to use Lisp for those parts of the expression where > it is necessary. > > I came up with the idea of \, after stumbling upon > query-replace-regexp-eval and noticing that the typical usage pattern > was to start something with C-M-%, type stuff into it, then do a > combination of C-k, C-g, C-M-Esc or other things I don't remember > right now, in order to restart the whole process using > query-replace-regexp-eval instead. And query-replace-regexp-eval does > not have a keybinding of its own. > > Basically it has been my experience that query-replace-regexp-eval is > a nice idea, but in practice quite unusable. \, achieves a similar > purpose but with a much more convenient interface. That's pretty much what I expected, but I wasn't sure if I wasn't perhaps missing something. > To get back to the original question: since \, has all of the > functionality of query-replace-regexp-eval with a more convenient > interface, query-replace-regexp-eval could be considered obsolete or > at least obscure. In that case, why keep `query-replace-regexp-eval'? You seem to be saying that there really is no separate use case for it. That's an argument for deprecating it. The (minor) advantage I see for it is the case that you hint at: It saves having to use the `\,...' syntax, when you know that you want Lisp evaluation (and only Lisp evaluation, for the entire replacement). That is, the interface of `query-replace-regexp' is more convenient _in general_, because it is more general and flexible. But it requires extra syntax (`\,...') whenever you want only Lisp eval. For that reason, someone might want to bind `query-replace-regexp-eval' to a key, to save some extra syntax (`\,...'). I think that these are the only reasonable options: 1. Get rid of `query-replace-regexp-eval', since you can always use the `\,...' syntax to get the same effect (and more). 2. Keep `query-replace-regexp-eval', and mention in its doc string that it is a shortcut that gives the effect of using `query-replace-regexp' with (only) `\,...'. If we choose #2, then the question is whether to mention `query-replace-regexp-eval' in the manual. It's not strictly needed, because users can find it via `apropos'. > Since we tell people how to do the same thing more flexibly with \, I > don't think that query-replace-regexp-eval deserves a place in the > manual. It would be a lot of additional explanation without any > conceivable benefit to the user. On the other hand, it could be described briefly in the manual in this way, and that might make things clearer: `query-replace-regexp-eval' - Query-replace text that matches a regexp by the result of evaluating a Lisp sexp, taken as a string. You are prompted for the regexp and the sexp. You can get the same effect by using the more general command `query-replace-regexp', enclosing the sexp within `\,...'. That makes clear what it does, and what its specific use case is. And it is not "a lot of additional explanation". I won't argue strongly for inclusion in the manual. But I will point out that "more flexibly" comes at the (minor) cost of using extra syntax for simple eval-only cases, and not bothering with that syntax can be a (minor) convenience - that's a user choice. I vote for 1) keeping it and 2) documenting it in the terms mentioned above. BTW, `query-replace-regexp', with `\,...' and all the rest, is one of the truly great features offered in Emacs 22, IMO. Bravo!