[Top][All Lists]

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

Re: something between try-completion and test-completion?

From: Stefan Monnier
Subject: Re: something between try-completion and test-completion?
Date: Wed, 06 Feb 2008 14:19:21 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.50 (gnu/linux)

> I'd be interested in a function similar to both `try-completion' and
> `test-completion', but which would just test whether its STRING arg can be
> completed against its COLLECTION arg, respecting its PREDICATE arg.

> It would be like `test-completion', in that as soon as some match is found
> it would return non-nil, not bothering to test the other completions and
> calculate the common prefix.

> It would be like `try-completion', in that it would test whether the STRING
> is a prefix of some COLLECTION element, not whether STRING is itself one of
> the COLLECTION elements.

> The idea is to have a quick version of `try-completion' for situations where
> the common prefix of all matches is not needed, and all you want is an
> indication of whether the STRING could be completed.

> Any other interest in this? Any chance this will become available?

Could you give us some sample situation where there'd be an actual
benefit (as in measurable performance difference) between try-completion
and the function you're looking for?


PS: Maybe you can hack it up by hand:

  (defun try-completion-p (string collection &optional predicate)
    (lexical-let ((predicate predicate))
      (catch 'tcp-found
        (try-completion string collection
                        (lambda (x)
                          (if (funcall predicate) (throw 'tcp-found t))))

reply via email to

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