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: Emanuel Berg
Subject: Re: ‘read-string’ over ‘read-from-minibuffer’
Date: Tue, 20 Jul 2021 17:46:11 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Stefan Monnier via Users list for the GNU Emacs text editor wrote:

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

Yes, we understand, it is not meant to be used directly from
Lisp in general but only from the type-specific functions,
however what happens is that you stumble upon it, test it and
it works, and then use it. Maybe the byte compiler can tell
you not to use it? (Can you make it not say the same when used
correctly/as intended?)

The docstring for `read-from-minibuffer', tho very long, it
does not mention either `read-string' or `read-number',
actually putting this information there might not help for the
most part since the impression is straightforward (which is
good!) and after testing it and seeing that it works as
expected, people will be even less inclined to read that long
doc string.

But, if you put it there, at least you can yank that part from
the docstring into a post like this so the "elaborating" part
will be faster :P

-- 
underground experts united
https://dataswamp.org/~incal




reply via email to

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