unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: "Drew Adams" <drew.adams@oracle.com>
Cc: Emacs-Devel <emacs-devel@gnu.org>
Subject: Re: something between try-completion and test-completion?
Date: Wed, 06 Feb 2008 14:19:21 -0500	[thread overview]
Message-ID: <jwvwsphdhhi.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <000801c868e3$fc3c8a30$9eb22382@us.oracle.com> (Drew Adams's message of "Wed, 6 Feb 2008 09:16:16 -0800")

> 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?


        Stefan


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))))
        nil)))




  reply	other threads:[~2008-02-06 19:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-06 17:16 something between try-completion and test-completion? Drew Adams
2008-02-06 19:19 ` Stefan Monnier [this message]
2008-02-06 21:19   ` Drew Adams
2008-02-06 22:12     ` Stefan Monnier
2008-02-07  3:36     ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvwsphdhhi.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=drew.adams@oracle.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).