[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#14176: 24.3.50; `bookmark-completing-read': prompt and return value
bug#14176: 24.3.50; `bookmark-completing-read': prompt and return value for "" DEFAULT
Fri, 12 Apr 2013 07:14:09 -0700
> > (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.