bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#14176: 24.3.50; `bookmark-completing-read': prompt and return value


From: Drew Adams
Subject: bug#14176: 24.3.50; `bookmark-completing-read': prompt and return value for "" DEFAULT
Date: Thu, 11 Apr 2013 14:32:36 -0700

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







reply via email to

[Prev in Thread] Current Thread [Next in Thread]