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

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

Re: ‘read-string’ over ‘read-from-minibuffer’


From: Stefan Monnier
Subject: Re: ‘read-string’ over ‘read-from-minibuffer’
Date: Tue, 20 Jul 2021 11:11:57 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Felix Dietrich [2021-07-20 14:05:03] wrote:
> Stefan Monnier <monnier@iro.umontreal.ca> writes:
>>>   (let*((read-result (read-from-minibuffer "Prompt: "))
>> Please don't use `read-from-minibuffer` unless you're defining
>> a `read-<foo>` function.
>> Use `read-string` instead.
>
> Could you elaborate?

`read-from-minibuffer` is the function designed as the core of `read-string`,
`read-number`, `completing-read`, and friends.

If you want to write such a `read-<foo>` function, then
`read-from-minibuffer` is for you.

If you want to just read a *string*, then `read-string` is what you
should use.  It doesn't behave very differently from
`read-from-minibuffer`, but it makes your code's intentions more clear.


        Stefan




reply via email to

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