From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tassilo Horn 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> Mime-Version: 1.0 Content-Type: text/plain Return-path: In-Reply-To: (Julien Danjou's message of "Mon, 21 Mar 2011 14:36:50 +0100") List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 To: Stefan Monnier Cc: emacs-orgmode@gnu.org, emacs-devel@gnu.org List-Id: emacs-orgmode.gnu.org 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