From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.help Subject: RE: syntax: anonymous vs. named functions Date: Sun, 16 Nov 2008 00:01:01 -0800 Message-ID: <006401c947c1$7811c320$0200a8c0@us.oracle.com> References: <3d16ac18-967c-4511-8c9c-9a80c40c3d8e@x16g2000prn.googlegroups.com><1226695506.850373@arno.fh-trier.de><1226766956.4606.4915.camel@localhost> <1226806929.4606.6060.camel@localhost> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1226822488 7704 80.91.229.12 (16 Nov 2008 08:01:28 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 16 Nov 2008 08:01:28 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: "'Matt Price'" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Nov 16 09:02:31 2008 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1L1caR-0004uI-MX for geh-help-gnu-emacs@m.gmane.org; Sun, 16 Nov 2008 09:02:27 +0100 Original-Received: from localhost ([127.0.0.1]:57989 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L1cZJ-0002e1-CW for geh-help-gnu-emacs@m.gmane.org; Sun, 16 Nov 2008 03:01:17 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1L1cZ0-0002du-Ps for help-gnu-emacs@gnu.org; Sun, 16 Nov 2008 03:00:58 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1L1cYz-0002d7-9e for help-gnu-emacs@gnu.org; Sun, 16 Nov 2008 03:00:58 -0500 Original-Received: from [199.232.76.173] (port=48915 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L1cYz-0002cx-3S for help-gnu-emacs@gnu.org; Sun, 16 Nov 2008 03:00:57 -0500 Original-Received: from rcsinet11.oracle.com ([148.87.113.123]:61843 helo=rgminet11.oracle.com) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1L1cYy-0000F3-4C for help-gnu-emacs@gnu.org; Sun, 16 Nov 2008 03:00:56 -0500 Original-Received: from acsinet13.oracle.com (acsinet13.oracle.com [141.146.126.235]) by rgminet11.oracle.com (Switch-3.3.1/Switch-3.3.1) with ESMTP id mAG81R2h002065 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 16 Nov 2008 08:01:28 GMT Original-Received: from acsmt700.oracle.com (acsmt700.oracle.com [141.146.40.70]) by acsinet13.oracle.com (Switch-3.3.1/Switch-3.3.1) with ESMTP id mAG813Cw014784; Sun, 16 Nov 2008 08:01:04 GMT Original-Received: from dradamslap1 (/24.23.165.218) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sun, 16 Nov 2008 00:00:44 -0800 X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <1226806929.4606.6060.camel@localhost> Thread-Index: AclHnYj1+65JiUP/T1u8pB3yY1lURwAIxIGQ X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3350 X-Source-IP: acsmt700.oracle.com [141.146.40.70] X-Auth-Type: Internal IP X-CT-RefId: str=0001.0A010203.491FD333.0005:SCFSTAT928724,ss=1,fgs=0 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 1) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:59826 Archived-At: > I have working code for my tab-completion problem (again thanks to > everyone for answering my painfully stupid questions). i don't > understand, though, why attempts to write my function as an unnamed > lambda fails, but the same function succeeds when named. the "lambda" > line commented out in tab-complete-from-function below > returns an error > "test-completion: Invalid function", while the uncommented call to a > different, trivial function is successful. cna anyone advise me why? > thanks much! > > (defun tab-complete-from-function (stub) > "very simple tab completion function" > (interactive (list (completing-read "Name: " > ;; (lambda (string) > (split-string (shell-command-to-string (concat > "/home/matt/mutt-eds-query " string)) "\n" t)) > (do-completion (string)) > nil t))) > (message stub)) > > > (defun do-completion (stub) > "minimal function" > (split-string (shell-command-to-string (concat > "/home/matt/mutt-eds-query " stub)) "\n" t)) (do-completion string) is not a function. It is a function application, and its value is a list of strings. The lambda form is a function. To use a function as the `completing-read' COLLECTION argument, the function must take the right (three) arguments and return the right values. See the doc for a description of the kind of function that is needed.