GNU bug report logs -
#14176
24.3.50; `bookmark-completing-read': prompt and return value for "" DEFAULT
Previous Next
Reported by: "Drew Adams" <drew.adams <at> oracle.com>
Date: Wed, 10 Apr 2013 22:09:01 UTC
Severity: normal
Found in version 24.3.50
Done: Stefan Monnier <monnier <at> iro.umontreal.ca>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
> > 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.
This bug report was last modified 12 years and 31 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.