From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.bugs Subject: bug#14176: 24.3.50; `bookmark-completing-read': prompt and return value for "" DEFAULT Date: Fri, 12 Apr 2013 07:14:09 -0700 Message-ID: <0C53172999584A498FB4190ADC8990CB@us.oracle.com> References: <7707C9A29C4748B093E2167A99592511@us.oracle.com><87txnda9qd.fsf@gmail.com> <87ehegjokl.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1365776117 30957 80.91.229.3 (12 Apr 2013 14:15:17 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 12 Apr 2013 14:15:17 +0000 (UTC) Cc: 14176@debbugs.gnu.org To: "'Thierry Volpiatto'" Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Apr 12 16:15:21 2013 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 1UQel7-00059b-2s for geb-bug-gnu-emacs@m.gmane.org; Fri, 12 Apr 2013 16:15:21 +0200 Original-Received: from localhost ([::1]:56057 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UQel6-0006hz-Hn for geb-bug-gnu-emacs@m.gmane.org; Fri, 12 Apr 2013 10:15:20 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:60129) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UQel3-0006hj-23 for bug-gnu-emacs@gnu.org; Fri, 12 Apr 2013 10:15:18 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UQekx-0002pO-BJ for bug-gnu-emacs@gnu.org; Fri, 12 Apr 2013 10:15:16 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:43330) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UQekx-0002p9-96 for bug-gnu-emacs@gnu.org; Fri, 12 Apr 2013 10:15:11 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1UQeoj-0005SO-JN for bug-gnu-emacs@gnu.org; Fri, 12 Apr 2013 10:19:05 -0400 X-Loop: help-debbugs@gnu.org Resent-From: "Drew Adams" Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 12 Apr 2013 14:19:05 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 14176 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 14176-submit@debbugs.gnu.org id=B14176.136577630020426 (code B ref 14176); Fri, 12 Apr 2013 14:19:05 +0000 Original-Received: (at 14176) by debbugs.gnu.org; 12 Apr 2013 14:18:20 +0000 Original-Received: from localhost ([127.0.0.1]:47439 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UQenz-0005JJ-FK for submit@debbugs.gnu.org; Fri, 12 Apr 2013 10:18:20 -0400 Original-Received: from userp1040.oracle.com ([156.151.31.81]:18891) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UQenu-0005Ic-PC for 14176@debbugs.gnu.org; Fri, 12 Apr 2013 10:18:15 -0400 Original-Received: from ucsinet22.oracle.com (ucsinet22.oracle.com [156.151.31.94]) by userp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id r3CEEIp7001884 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 12 Apr 2013 14:14:18 GMT Original-Received: from aserz7022.oracle.com (aserz7022.oracle.com [141.146.126.231]) by ucsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r3CEEGN4016627 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Fri, 12 Apr 2013 14:14:17 GMT Original-Received: from abhmt118.oracle.com (abhmt118.oracle.com [141.146.116.70]) by aserz7022.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r3CEEG2l026538; Fri, 12 Apr 2013 14:14:16 GMT Original-Received: from dradamslap1 (/10.159.167.111) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 12 Apr 2013 07:14:16 -0700 X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <87ehegjokl.fsf@gmail.com> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Thread-Index: Ac43QAAiIOeFN+75Tg+ukSbg+tWvzgAQ0ZYw X-Source-IP: ucsinet22.oracle.com [156.151.31.94] 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.x 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:73359 Archived-At: > > (The handling of a cons DEFAULT is appropriate since Emacs > > 23. But that minor enhancement is really separate from > > this bug report. #1 is just about empty parens in the prompt.) > > Don't see why DEFAULT would be a cons, a bookmark name is a > string, so IMO DEFAULT should be a string or nil. As I said, it is not important for this bug report. But the DEF arg of `completing-read' can in general be a list of default values. No reason to lose that generality here. That's all. > > Wrt #2: > > > > a. I misspoke a bit. The behavior was that nil (not "") was > > returned when DEFAULT is nil and the user enters empty input. IMO, > > the value returned should be "" (which Thierry's patch fixes, BTW). > > > > Given that correction, this (new) behavior should be > > pointed out in the doc string. That is #2 of the bug report. > > > > IOW, the function should always return a string, and that > > string should be empty ("") if DEFAULT is nil and the user input > > is empty. > > (bookmark-completing-read "test") => "" That is the correct behavior, IMO. It was not the behavior before the patch. It returned nil before (i.e., it still returns nil in trunk and in 24.3). > > And we should point out this behavior explicitly in the doc string, > > for clarity. > > Maybe you can provide a patch ?... For the doc string: DEFAULT is a string to return if the user input is empty. If DEFAULT is nil (absent) then return "" for empty input. Or if a cons DEFAULT is accepted then this is all we need: DEFAULT is as for `completing-read'. Or if you don't want such indirection and a cons DEFAULT is accepted: DEFAULT is a string or a list of strings. If the user input is empty then return the string (or the first string in the list). If DEFAULT is nil (absent) then return "" for empty input. The last one is more explicit. This might be helpful, since returning "" instead of nil for empty input is an incompatible change. Prior to Emacs 22, `(nil)' was returned for empty input. Since Emacs 22, `nil' is returned. With this correction, `""' will be returned.