Ok, here is the revised patch. I added a test and reformatted the commit message in (hopefully) ChangeLog format. The test includes a few basic tests of "completion-table-with-predicate" including one which is fixed by this patch (noted in the test comments).
I've dropped the second patch entirely, because I realized it was inappropriately optimizing for a rare case (i.e. PRED1 being nil).
Also, a few other related things: First, I noticed that while the test file name is minibuffer-tests.el, the lisp header and provide statement both contain "completion-tests.el" instead. Presumably this file was renamed at some point without updating its contents.
Let me know if there is interest in using such an approach to add automated tests for some of the core interactive Emacs functions like "completing-read".
On 8/5/17 2:00 AM, Ryan Thompson wrote:
> Would you also like me
> to provide an example where the old code does the wrong thing?
Adding a test case or two to test/lisp/minibuffer-tests.el would be
ideal (in the same patch that fixes it).