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

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

Re: Reading from minibuffer with default value when return pressed


From: Johan Bockgård
Subject: Re: Reading from minibuffer with default value when return pressed
Date: Mon, 23 Apr 2007 16:13:19 +0200
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.93 (gnu/linux)

Nordlöw <per.nordlow@gmail.com> writes:

> I thought the following should work but it doesn't
> (read-from-minibuffer "Grep for string: " nil nil nil nil "default"
> nil)

C-h f read-from-minibuffer

    [...]
    Sixth arg DEFAULT-VALUE is the default value. If non-nil, it is
    available for history commands; but, unless READ is non-nil,
    `read-from-minibuffer' does NOT return DEFAULT-VALUE if the user
    enters empty input! It returns the empty string.

> Do I need an alternative to read-from-minibuffer() or have I missed
> something=

You can just test for "", or use read-string:

    Fourth arg DEFAULT-VALUE is the default value. If non-nil, it is
    used for history commands, and as the value to return if the user
    enters the empty string.

-- 
Johan Bockgård


reply via email to

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