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: Chris McMahan
Subject: Re: Reading from minibuffer with default value when return pressed
Date: Mon, 23 Apr 2007 13:05:53 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.95 (windows-nt)

Take a look at the function
 completing-read

... If initial-input is non-nil, insert it in the minibuffer initially,
  with point positioned at the end.

I'm using it to set the default value when creating a shell buffer.

- Chris

bojohan+news@dd.chalmers.se (Johan Bockgård) writes:

> 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

-- 
     (.   .)
  =ooO=(_)=Ooo=====================================
  Chris McMahan | first_initiallastname@one.dot.net
  =================================================


reply via email to

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