From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.devel,gmane.emacs.orgmode Subject: Re: Completing with anything Date: Mon, 21 Mar 2011 15:17:20 +0100 Message-ID: <87d3lkfthr.fsf@member.fsf.org> References: <87r5bhysp6.fsf@keller.adm.naquadah.org> <878vxovsym.fsf@keller.adm.naquadah.org> <87k4h7ua23.fsf@member.fsf.org> <87vd0romky.fsf@keller.adm.naquadah.org> <87mxm2na63.fsf@member.fsf.org> <87vd0qfhu3.fsf@member.fsf.org> <87lj08fxge.fsf@member.fsf.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1300717068 7579 80.91.229.12 (21 Mar 2011 14:17:48 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 21 Mar 2011 14:17:48 +0000 (UTC) Cc: emacs-orgmode@gnu.org, emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Mar 21 15:17:44 2011 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.69) (envelope-from ) id 1Q1fvS-0007UR-30 for ged-emacs-devel@m.gmane.org; Mon, 21 Mar 2011 15:17:42 +0100 Original-Received: from localhost ([127.0.0.1]:50553 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q1fvQ-0006JW-TQ for ged-emacs-devel@m.gmane.org; Mon, 21 Mar 2011 10:17:40 -0400 Original-Received: from [140.186.70.92] (port=36957 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q1fvD-0006J4-Rn for emacs-devel@gnu.org; Mon, 21 Mar 2011 10:17:28 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q1fvC-0004jY-FI for emacs-devel@gnu.org; Mon, 21 Mar 2011 10:17:27 -0400 Original-Received: from deliver.uni-koblenz.de ([141.26.64.15]:22458) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q1fvC-0004jH-2i; Mon, 21 Mar 2011 10:17:26 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by deliver.uni-koblenz.de (Postfix) with ESMTP id B1E797816FCF; Mon, 21 Mar 2011 15:17:24 +0100 (CET) Original-Received: from deliver.uni-koblenz.de ([127.0.0.1]) by localhost (deliver.uni-koblenz.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 31743-09; Mon, 21 Mar 2011 15:17:23 +0100 (CET) X-CHKRCPT: Envelopesender noch tassilo@member.fsf.org Original-Received: from thinkpad (tsdh.uni-koblenz.de [141.26.67.142]) by deliver.uni-koblenz.de (Postfix) with ESMTP id 36B907816FD2; Mon, 21 Mar 2011 15:17:20 +0100 (CET) In-Reply-To: (Julien Danjou's message of "Mon, 21 Mar 2011 14:36:50 +0100") User-Agent: Gnus/5.110016 (No Gnus v0.16) Emacs/24.0.50 (gnu/linux) X-Virus-Scanned: amavisd-new at uni-koblenz.de X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Received-From: 141.26.64.15 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:137475 gmane.emacs.orgmode:39876 Archived-At: Julien Danjou writes: Hi Julien, >> Isn't completion of "L" to "Lionel" at the beginning of a line >> exactly what your completion function should enable? > > No. To give a even more concrete application of my example: I'd like > org-contacts to give completion for email addresses or nicknames. If > you have a contact entry like: > > - Name: Emmett Brown > - Nickname: doc > - Email address: gigawatt@delorean.com > > What I'd like to do is that if the user enters: > > doc > > is that it can be completed to > "Emmett Brown " > > But if I return such an item in COLLECTION, it just gets ignored > because "Emmett Brown " does not match "doc". Now that is a completely understandable example! :-) On the one hand, I'm a bit tempted to say that this is no COMPLETION, but a kind of ABBREV EXPANSION (just like abbrev.el, skeleton.el, temo.el, yasnippet.el, ...). On the other hand, I clearly see the usefulness of such a dynamic "expansion-at-point". What might be a solution is to allow COLLECTION to contain not only strings, but also pairs (MATCH . EXPANSION), like ("doc" . "Emmett Brown "). But I'm really no expert with the completion code, so I cannot speak on how much effort that is, and if it would break things. For example, with normal completions you can usually cycle thru all completion possibilities. Not sure if that would work after an expansion has taken place. Bye, Tassilo