From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: read-regexp Date: Sat, 18 Oct 2008 19:19:45 +0300 Organization: JURTA Message-ID: <87iqrp7wgm.fsf@jurta.org> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1224346856 22434 80.91.229.12 (18 Oct 2008 16:20:56 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 18 Oct 2008 16:20:56 +0000 (UTC) Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Oct 18 18:21:56 2008 connect(): Connection refused 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 1KrEYu-0004lI-Fw for ged-emacs-devel@m.gmane.org; Sat, 18 Oct 2008 18:21:56 +0200 Original-Received: from localhost ([127.0.0.1]:38380 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KrEXp-0001WS-8i for ged-emacs-devel@m.gmane.org; Sat, 18 Oct 2008 12:20:49 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KrEXj-0001Ta-Pk for emacs-devel@gnu.org; Sat, 18 Oct 2008 12:20:43 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KrEXg-0001S1-Al for emacs-devel@gnu.org; Sat, 18 Oct 2008 12:20:42 -0400 Original-Received: from [199.232.76.173] (port=54295 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KrEXg-0001Ry-6J for emacs-devel@gnu.org; Sat, 18 Oct 2008 12:20:40 -0400 Original-Received: from relay02.kiev.sovam.com ([62.64.120.197]:53711) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KrEXc-0000wm-Q6; Sat, 18 Oct 2008 12:20:37 -0400 Original-Received: from [83.170.232.243] (helo=smtp.svitonline.com) by relay02.kiev.sovam.com with esmtp (Exim 4.67) (envelope-from ) id 1KrEXW-0003DZ-Bn; Sat, 18 Oct 2008 19:20:30 +0300 In-Reply-To: (Eli Zaretskii's message of "Sat, 18 Oct 2008 14:41:59 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (x86_64-pc-linux-gnu) X-Scanner-Signature: 4fcf7b0c3bd3465242a83b332b797d78 X-DrWeb-checked: yes X-SpamTest-Envelope-From: juri@jurta.org X-SpamTest-Group-ID: 00000000 X-SpamTest-Header: Trusted X-SpamTest-Info: Profiles 5422 [Oct 16 2008] X-SpamTest-Info: {received from trusted relay: common white list} X-SpamTest-Info: {HEADERS: header Content-Type found without required header Content-Transfer-Encoding} X-SpamTest-Method: white ip list X-SpamTest-Rate: 10 X-SpamTest-Status: Trusted X-SpamTest-Status-Extended: trusted X-SpamTest-Version: SMTP-Filter Version 3.0.0 [0278], KAS30/Release X-detected-operating-system: by monty-python.gnu.org: FreeBSD 6.x (1) 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:104594 Archived-At: > This function accepts an optional argument DEFAULT, but it does not > add its value to the list of defaults it passes to > read-from-minibuffer. Is that intentional, and if so, what is the > reason for this behavior? > > Also, it sounds like DEFAULT must be a single string or nil, it cannot > be a list of strings, as in other functions that read from the > minibuffer. Again, is that on purpose? > > (Btw, it would be good if the doc string gave answers to these > questions.) The problem is in the ambiguous name of the argument DEFAULT. It was intended to provide exactly the same functionality as the argument STRING-DESCRIBING-DEFAULT of the function `read-face-name', i.e. to display in the minibuffer prompt what default the function will use if the user types RET. I thought that the name STRING-DESCRIBING-DEFAULT is too long and clumsy but had no better idea. Unless you want to propose a better name, I will rename the argument DEFAULT of `read-regexp' to the same name STRING-DESCRIBING-DEFAULT as below with docstring fixes: Index: lisp/replace.el =================================================================== RCS file: /sources/emacs/emacs/lisp/replace.el,v retrieving revision 1.276 diff -c -r1.276 replace.el *** lisp/replace.el 12 Sep 2008 00:37:41 -0000 1.276 --- lisp/replace.el 18 Oct 2008 16:17:48 -0000 *************** *** 522,532 **** Maximum length of the history list is determined by the value of `history-length', which see.") ! (defun read-regexp (prompt &optional default) "Read regexp as a string using the regexp history and some useful defaults. Prompt for a regular expression with PROMPT (without a colon and ! space) in the minibuffer. The optional string argument DEFAULT ! provides the basic default value, that is returned on typing RET. Additional defaults are the string at point, the last isearch regexp, the last isearch string, and the last replacement regexp." (let* ((defaults --- 526,537 ---- Maximum length of the history list is determined by the value of `history-length', which see.") ! (defun read-regexp (prompt &optional string-describing-default) "Read regexp as a string using the regexp history and some useful defaults. Prompt for a regular expression with PROMPT (without a colon and ! space) in the minibuffer. The optional argument STRING-DESCRIBING-DEFAULT ! provides the value to display in the minibuffer prompt that is ! returned if the user just types RET. Additional defaults are the string at point, the last isearch regexp, the last isearch string, and the last replacement regexp." (let* ((defaults *************** *** 544,555 **** (history-add-new-input nil) (input (read-from-minibuffer ! (if default ! (format "%s (default %s): " prompt (query-replace-descr default)) (format "%s: " prompt)) nil nil nil 'regexp-history defaults t))) (if (equal input "") ! default (prog1 input (add-to-history 'regexp-history input))))) --- 549,561 ---- (history-add-new-input nil) (input (read-from-minibuffer ! (if string-describing-default ! (format "%s (default %s): " prompt ! (query-replace-descr string-describing-default)) (format "%s: " prompt)) nil nil nil 'regexp-history defaults t))) (if (equal input "") ! string-describing-default (prog1 input (add-to-history 'regexp-history input))))) -- Juri Linkov http://www.jurta.org/emacs/