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

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

bug#20063: 24.4: read-from-minibuffer improperly setting hist parameter


From: Boruch Baum
Subject: bug#20063: 24.4: read-from-minibuffer improperly setting hist parameter
Date: Tue, 10 Mar 2015 11:34:00 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.4.0

On 03/09/2015 02:14 PM, Stefan Monnier wrote:
>> 1] From a programmer's perspective, forcing a HIST when the programmer
>> asks for COLLECTION = !nil and HIST = nil, creates a conflict when
>> parameter REQUIRE-MATCH is set to `t', because the mini-buffer will
>> offer entries, from HIST, that are not in COLLECTION, and those entries
>> will then just be rejected due to REQUIRE-MATCH.
> 
> That is indeed a problem, but it is more general than the case of
> HIST=nil, since even if HIST is non-nil the history may contain entries
> which are not valid according to COLLECTION.
> 
> So what we need to do is to filter out those entries dynamically.
Yes, if you mean once, at the time the function is invoked; but the
benefit of this to the end-user is very limited, and has a downside if
done simply. Once REQUIRE-MATCH=t, nothing but elements of COLLECTION
will ever be accepted, so `concat'-ing the filtered elements of HIST
would present only legitimate options, in the sequence most recently
used, but with potentially a lot of duplicate entries. Using
`add-to-list', starting with an empty list would avoid the duplications
and present the elements in sequence most-recently-used.

>> 2] From a programmer's perspective, there are four legitimate
>> combinations of COLLECTION and HIST, and the current state denies a
>> programmer the freedom to offer a specific COLLECTION without some
>> general HIST.
> 
> Actually, IIRC a value of t for HIST
I don't see that in the v24.4 documentation for `completing-read' or
'read-from-minibuffer'. Both descriptions are a bit vague, saying "...
if non-nil ... It can be a symbol, which is the history list variable to
use, or it can be a cons cell (HISTVAR . HISTPOS) ...". It would be
clearer to change "It can be" to "Otherwise it must be either"

>  does provide the option of "no history".
Which brings us full-circle to line 974 of `minibuf.c'


-- 
hkp://keys.gnupg.net
CA45 09B5 5351 7C11 A9D1  7286 0036 9E45 1595 8BC0


Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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