all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
To: "'Thierry Volpiatto'" <thierry.volpiatto@gmail.com>,
	<14176@debbugs.gnu.org>
Subject: bug#14176: 24.3.50; `bookmark-completing-read': prompt and return value for "" DEFAULT
Date: Thu, 11 Apr 2013 14:32:36 -0700	[thread overview]
Message-ID: <A794C7112AB442ECB725014ADA9F8A39@us.oracle.com> (raw)
In-Reply-To: <87txnda9qd.fsf@gmail.com>

> > 1. Do not insert DEFAULT, in parens, into the PROMPT if 
> >    DEFAULT is "".
> >  
> > 2. Doc string should mention the return value ("") for 
> >    empty input ("") when DEFAULT is nil.
>
> Here a patch:...

Wrt #1:

No, that patch does not work:

M-: (bookmark-completing-read "Bookmark" "")

The prompt still shows empty parens: "Bookmark (): ".

The prompt should be handled like this (or equivalent):

(if (and default  (not (equal "" default)))
;                 ^^^^^^^^^^^^^^^^^^^^^^^^
    (concat prompt
            (format " (%s): "
                    (if (consp default)
                        (car default)
                       default)
                    default))
  (concat prompt ": "))

(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.)


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.  And we should point out
this behavior explicitly in the doc string, for clarity.







  parent reply	other threads:[~2013-04-11 21:32 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-10 22:04 bug#14176: 24.3.50; `bookmark-completing-read': prompt and return value for "" DEFAULT Drew Adams
2013-04-11  5:59 ` Thierry Volpiatto
2013-04-11 14:03   ` Stefan Monnier
2013-04-11 15:10     ` Thierry Volpiatto
2013-04-11 21:32   ` Drew Adams [this message]
2013-04-12  5:38     ` Thierry Volpiatto
2013-04-12 14:14       ` Drew Adams
2013-04-13  8:16         ` Thierry Volpiatto
2013-04-13 15:46           ` Drew Adams
2013-04-19  5:12           ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=A794C7112AB442ECB725014ADA9F8A39@us.oracle.com \
    --to=drew.adams@oracle.com \
    --cc=14176@debbugs.gnu.org \
    --cc=thierry.volpiatto@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.