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

From: Boruch Baum <[email-masked]>
Date: Mon, 09 Mar 2015 08:05:11 -0400

Three reasons I think this should be considered a bug, and changed - two
from a programmer's perspective, and one from a user's perspective. For
both, consider the cases of functions `toggle-option' (this bug report)
and `highlight-regexp' (bug #19877).

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.

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.

3] From a user's perspective (and this is how I came across both
instances of this issue), I don't want invalid or nonsense options being
presented to me by emacs. They just confuse, invite unwanted outcomes,
and delay finishing the task at hand. In the case of `toggle-option',
the current situation has the mini-buffer offering the user options
that, should the user select, will be rejected as invalid by the
mini-buffer. In the case of `highlight-regexp', the choices that the
mini-buffer offer from HIST are accepted, but are undesirable, lead to
confusion in selection, and confusion in navigating amongst the
desirable elements, ie. those in COLLECTION.

On 03/08/2015 09:08 PM, Glenn Morris wrote:
> Boruch Baum wrote:
> 
>> Function `toggle-option' calls `completing-read', without providing
>> parameters REQUIRE-MATCH or HIST. `completing-read' calls
>> `completing-read-default' in `minibuffer.el'. `completing-read-default'
>> calls `read-from-minibuffer' in `minibuf.c'. There, on line 974 of
>> `minibuf.c:'
>>
>>      if (NILP (histvar))
>>        histvar = Qminibuffer_history;
>>
>> If I understand this correctly, this says that even if the caller
>> explicitly says that there should be no history used (condition nil),
>> the Qminibuffer_history should be used anyway.
> 
> Nil means use the default history list. Eg see "Minibuffer History" in
> the elisp manual:
> 
>   If you don't specify HISTORY, then the default history list
>   `minibuffer-history' is used.
> 
> I don't see a bug here, other than perhaps the doc of completing-read
> could stand to be more explicit, like the elisp manual is.
> 

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