From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: something between try-completion and test-completion? Date: Wed, 06 Feb 2008 14:19:21 -0500 Message-ID: References: <000801c868e3$fc3c8a30$9eb22382@us.oracle.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1202325632 15849 80.91.229.12 (6 Feb 2008 19:20:32 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 6 Feb 2008 19:20:32 +0000 (UTC) Cc: Emacs-Devel To: "Drew Adams" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Feb 06 20:20:54 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JMppG-0007r0-5Y for ged-emacs-devel@m.gmane.org; Wed, 06 Feb 2008 20:20:54 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JMpon-0007pz-L9 for ged-emacs-devel@m.gmane.org; Wed, 06 Feb 2008 14:20:25 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JMpnp-0007Ul-Ml for emacs-devel@gnu.org; Wed, 06 Feb 2008 14:19:25 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JMpno-0007Tp-2A for emacs-devel@gnu.org; Wed, 06 Feb 2008 14:19:25 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JMpnn-0007Ti-Pb for emacs-devel@gnu.org; Wed, 06 Feb 2008 14:19:23 -0500 Original-Received: from ironport2-out.pppoe.ca ([206.248.154.182]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JMpnn-00013Y-Gm for emacs-devel@gnu.org; Wed, 06 Feb 2008 14:19:23 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAALyWqUfO+J95dGdsb2JhbACQMgEwgSKbbIEA X-IronPort-AV: E=Sophos;i="4.25,313,1199682000"; d="scan'208";a="13776799" Original-Received: from smtp.pppoe.ca ([65.39.196.238]) by ironport2-out.pppoe.ca with ESMTP; 06 Feb 2008 14:19:22 -0500 Original-Received: from pastel.home ([206.248.159.121]) by smtp.pppoe.ca (Internet Mail Server v1.0) with ESMTP id MVZ36722; Wed, 06 Feb 2008 14:19:22 -0500 Original-Received: by pastel.home (Postfix, from userid 20848) id DCE3A7FD7; Wed, 6 Feb 2008 14:19:21 -0500 (EST) In-Reply-To: <000801c868e3$fc3c8a30$9eb22382@us.oracle.com> (Drew Adams's message of "Wed, 6 Feb 2008 09:16:16 -0800") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.50 (gnu/linux) X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:88351 Archived-At: > 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)))