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

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

Re: need obsolete arg in (read-from-minibuffer ...)


From: Stefan Monnier
Subject: Re: need obsolete arg in (read-from-minibuffer ...)
Date: Fri, 18 Mar 2011 21:59:55 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

>>> the docs say that 2nd arg is obsolete.  However,
>>> I've tried a lot of permutations of the args listed and I 
>>> can't get this function to work without using that obsolete 2nd arg.
>>> (defun mygetstr (def-val)
>>> (read-from-minibuffer "Enter/Edit string: "
>>> def-val nil nil nil def-val t))

First note: you probably don't want to use read-from-minibuffer, but use
read-string instead (read-from-minibuffer is lower-level and slightly more
tricky to use right).

>> What do you mean by "work"?  And what do you mean "without" the
>> obsolete arg?
> Sorry, I should have been clearer.  If I change the 2nd arg from
> "def-val" to "nil", then def-val isn't displayed in the minibuffer for
> editing by the user.

Exactly: placing the default value into the minibuffer text is what
is discouraged.  Instead, you should pass it as the `default-value'
argument and manually make your prompt look like
"<prompt> (default <def>): "
I know it sounds silly, but ...blablabla... history ...blablabla...

> However, the docs say that this arg is obsolete.
> I take this to mean that it should be left as "nil".

Unless you really have a good argument why you want the initial
minibuffer content to not be empty, of course.  The "obsolete" is really
about the UI guidelines and should be enforced differently ideally, but
for now that's what we have.


        Stefan


reply via email to

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