GNU bug report logs - #21644
24.4; completing-read acts differently on functional collection

Previous Next

Package: emacs;

Reported by: "Ryan C. Thompson" <rct <at> thompsonclan.org>

Date: Wed, 7 Oct 2015 22:57:01 UTC

Severity: normal

Found in version 24.4

Done: Dmitry Gutov <dgutov <at> yandex.ru>

Bug is archived. No further changes may be made.

Full log


Message #11 received at 21644 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Oleh Krehel <ohwoeowho <at> gmail.com>, "Ryan C. Thompson"
 <rct <at> thompsonclan.org>
Cc: 21644 <at> debbugs.gnu.org
Subject: Re: bug#21644: 24.4; completing-read acts differently on functional
 collection
Date: Tue, 13 Oct 2015 04:23:23 +0300
On 10/08/2015 01:13 PM, Oleh Krehel wrote:

> I can reproduce this as well, although "TAB RET" works where "RET"
> doesn't. I attach a patch with a fix. If someone can check it I can push
> it. The patch doesn't solve all the intricacies of
> `completion-ignore-case' that were mentioned in that function's
> comments, just this specific use case.

Is there really a bug here?

The example code didn't handle `test-completion' (the case when ALL 
would be `lambda').

With this definition, the behavior is the same in either case:

(defun collection-as-function (collection)
  "Return a function equivalent to COLLECTION.

The returned function will work equivalently to COLLECTION when
passed to `all-completions' and `try-completion'."
  (if (functionp collection)
      collection
    ;; Capture collection in a closure
    (lambda (string pred all)
      (funcall
       (cond
        ((eq all 't)
         #'all-completions)
        ((eq all 'lambda)
         #'test-completion)
        (t
         #'try-completion))
       string collection pred))))






This bug report was last modified 9 years and 220 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.