From: "Drew Adams" <drew.adams@oracle.com>
To: "'Thierry Volpiatto'" <thierry.volpiatto@gmail.com>
Cc: 14176@debbugs.gnu.org
Subject: bug#14176: 24.3.50; `bookmark-completing-read': prompt and return value for "" DEFAULT
Date: Fri, 12 Apr 2013 07:14:09 -0700 [thread overview]
Message-ID: <0C53172999584A498FB4190ADC8990CB@us.oracle.com> (raw)
In-Reply-To: <87ehegjokl.fsf@gmail.com>
> > (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.
next prev parent reply other threads:[~2013-04-12 14:14 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
2013-04-12 5:38 ` Thierry Volpiatto
2013-04-12 14:14 ` Drew Adams [this message]
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0C53172999584A498FB4190ADC8990CB@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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).