From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#12321: 24.2.50; `read-regexp' parameter PROMPT Date: Thu, 20 Sep 2012 11:18:10 +0300 Organization: JURTA Message-ID: <87a9wlbiwv.fsf@mail.jurta.org> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1348130560 12267 80.91.229.3 (20 Sep 2012 08:42:40 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 20 Sep 2012 08:42:40 +0000 (UTC) Cc: 12321@debbugs.gnu.org To: "Drew Adams" Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Sep 20 10:42:44 2012 Return-path: Envelope-to: geb-bug-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 1TEcLM-0004ys-3K for geb-bug-gnu-emacs@m.gmane.org; Thu, 20 Sep 2012 10:42:44 +0200 Original-Received: from localhost ([::1]:58339 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TEcLH-0005dw-NE for geb-bug-gnu-emacs@m.gmane.org; Thu, 20 Sep 2012 04:42:39 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:49286) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TEcLF-0005dl-1o for bug-gnu-emacs@gnu.org; Thu, 20 Sep 2012 04:42:38 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TEcLA-0004H1-R9 for bug-gnu-emacs@gnu.org; Thu, 20 Sep 2012 04:42:36 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:34967) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TEcLA-0004Gn-O6 for bug-gnu-emacs@gnu.org; Thu, 20 Sep 2012 04:42:32 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1TEcMc-0002CL-Gy for bug-gnu-emacs@gnu.org; Thu, 20 Sep 2012 04:44:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 20 Sep 2012 08:44:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 12321 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 12321-submit@debbugs.gnu.org id=B12321.13481306008383 (code B ref 12321); Thu, 20 Sep 2012 08:44:02 +0000 Original-Received: (at 12321) by debbugs.gnu.org; 20 Sep 2012 08:43:20 +0000 Original-Received: from localhost ([127.0.0.1]:44511 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TEcLv-0002BA-Gr for submit@debbugs.gnu.org; Thu, 20 Sep 2012 04:43:20 -0400 Original-Received: from ps18281.dreamhost.com ([69.163.218.105]:45330 helo=ps18281.dreamhostps.com) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TEcLr-0002Aw-Sl for 12321@debbugs.gnu.org; Thu, 20 Sep 2012 04:43:17 -0400 Original-Received: from localhost (ps18281.dreamhostps.com [69.163.218.105]) by ps18281.dreamhostps.com (Postfix) with ESMTP id B31EF451CC5C; Thu, 20 Sep 2012 01:41:43 -0700 (PDT) In-Reply-To: (Drew Adams's message of "Fri, 31 Aug 2012 15:38:45 -0700") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (x86_64-pc-linux-gnu) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:64636 Archived-At: > First, there is the business of automatically handling `: ' for the > PROMPT. I thought we had finally gotten away from this kind of thing. > It just gives callers less control. There are three contradicting requirements: 1. Maintain backward-compatibility for the PROMPT arg in all existing calls to `read-regexp'. 2. Do not append automatically ": " to the end of PROMPT. As bug#7567 demonstrates, more control for callers is necessary to be able to use `read-regexp' in such specific contexts as in `query-replace-read-from' that constructs prompt according to the special format "%s (default %s -> %s): ". 3. The code should not be so "clever" in supporting two these options above at the same time, as you said in http://thread.gmane.org/gmane.emacs.devel/134852/focus=134854 But from these three options I see no better thing to do than to allow `read-regexp' to be "clever" (like `read-buffer'): === modified file 'lisp/replace.el' --- lisp/replace.el 2012-09-09 22:15:24 +0000 +++ lisp/replace.el 2012-09-20 08:15:20 +0000 @@ -597,10 +597,12 @@ (defun read-regexp (prompt &optional def (history-add-new-input nil) (input (read-from-minibuffer - (if default-value - (format "%s (default %s): " prompt - (query-replace-descr default-value)) - (format "%s: " prompt)) + (if (string-match-p ":[ \t]*\\'" prompt) + prompt + (if default-value + (format "%s (default %s): " prompt + (query-replace-descr default-value)) + (format "%s: " prompt))) nil nil nil 'regexp-history defaults t))) (if (equal input "") (or default-value input)