From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thierry Volpiatto 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:38:34 +0200 Organization: Emacs Helm Message-ID: <87ehegjokl.fsf@gmail.com> References: <7707C9A29C4748B093E2167A99592511@us.oracle.com> <87txnda9qd.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1365745151 3897 80.91.229.3 (12 Apr 2013 05:39:11 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 12 Apr 2013 05:39:11 +0000 (UTC) Cc: 14176@debbugs.gnu.org To: "Drew Adams" Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Apr 12 07:39:15 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 1UQWhf-0003Az-3T for geb-bug-gnu-emacs@m.gmane.org; Fri, 12 Apr 2013 07:39:15 +0200 Original-Received: from localhost ([::1]:55674 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UQWhe-0002Zk-Ow for geb-bug-gnu-emacs@m.gmane.org; Fri, 12 Apr 2013 01:39:14 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:50036) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UQWhb-0002Y3-Bm for bug-gnu-emacs@gnu.org; Fri, 12 Apr 2013 01:39:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UQWha-0003Qx-8h for bug-gnu-emacs@gnu.org; Fri, 12 Apr 2013 01:39:11 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:42674) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UQWha-0003Qp-4b for bug-gnu-emacs@gnu.org; Fri, 12 Apr 2013 01:39:10 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1UQWlK-0004H1-GH for bug-gnu-emacs@gnu.org; Fri, 12 Apr 2013 01:43:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Thierry Volpiatto Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 12 Apr 2013 05:43:02 +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.136574536016247 (code B ref 14176); Fri, 12 Apr 2013 05:43:02 +0000 Original-Received: (at 14176) by debbugs.gnu.org; 12 Apr 2013 05:42:40 +0000 Original-Received: from localhost ([127.0.0.1]:46783 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UQWkx-0004Dv-Ix for submit@debbugs.gnu.org; Fri, 12 Apr 2013 01:42:40 -0400 Original-Received: from mail-wi0-f173.google.com ([209.85.212.173]:55325) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UQWku-0004DJ-NV for 14176@debbugs.gnu.org; Fri, 12 Apr 2013 01:42:38 -0400 Original-Received: by mail-wi0-f173.google.com with SMTP id m6so213128wiv.12 for <14176@debbugs.gnu.org>; Thu, 11 Apr 2013 22:38:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:organization:references:date :in-reply-to:message-id:user-agent:mime-version:content-type; bh=zNpopfU9efhkOdOlHmPk4sAIquNrHxm177jIz5dlbYc=; b=WnaEbzFU5HX7f6uphDB5rfYt6zAlCd1MxEIzi/S749Bk0nT3yON8HJkDT/TMhhVB3x fNbVvjf3XJjMrVGPYDjf5G+EG1wW2OPOYjgfLhYDLfDe3RYLa2jcfuazcpzJAXGEeJj9 jbQdmoj/Vrvr/afQJ2K0iK1TrE03csWvA06EerPyj3Aownmz4QIy6tcZinP7c7rqYE7J 351odQ7YZl9CzhunWkTAgZhS/lwk+6L6vtwHEl05psRULIALiSfi78Ba1GAKrN6rmcqb 8EaqGoHTd/fna98ZXEE/dopX+67E1A2jW4Ij0J9eEzud97NbmbmIJ5bSzCf9X6vp9YaG dhPg== X-Received: by 10.180.77.10 with SMTP id o10mr1607409wiw.10.1365745123080; Thu, 11 Apr 2013 22:38:43 -0700 (PDT) Original-Received: from dell-14z (lbe83-2-78-243-104-167.fbx.proxad.net. [78.243.104.167]) by mx.google.com with ESMTPS id g9sm1363219wix.1.2013.04.11.22.38.40 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 11 Apr 2013 22:38:42 -0700 (PDT) In-Reply-To: (Drew Adams's message of "Thu, 11 Apr 2013 14:32:36 -0700") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) 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:73353 Archived-At: "Drew Adams" writes: > The prompt still shows empty parens: "Bookmark (): ". diff --git a/lisp/bookmark.el b/lisp/bookmark.el index c1d8a4a..ad1609b 100644 --- a/lisp/bookmark.el +++ b/lisp/bookmark.el @@ -437,22 +437,18 @@ the empty string." 'string-lessp) (bookmark-all-names))) (let* ((completion-ignore-case bookmark-completion-ignore-case) - (default default) + (default (unless (string= "" default) default)) (prompt (concat prompt (if default (format " (%s): " default) - ": "))) - (str - (completing-read prompt - (lambda (string pred action) - (if (eq action 'metadata) - '(metadata (category . bookmark)) - (complete-with-action - action bookmark-alist string pred))) - nil - 0 - nil - 'bookmark-history))) - (if (string-equal "" str) default str)))) + ": ")))) + (completing-read prompt + (lambda (string pred action) + (if (eq action 'metadata) + '(metadata (category . bookmark)) + (complete-with-action + action bookmark-alist string pred))) + nil 0 nil 'bookmark-history default)))) + (defmacro bookmark-maybe-historicize-string (string) > (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. > > 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" "") => "" (bookmark-completing-read "test") => "" (bookmark-completing-read "test" "foo") => "foo" > And we should point out this behavior explicitly in the doc string, > for clarity. Maybe you can provide a patch ?... Thanks. -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997