From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daimrod Subject: Re: org-contacts email completion by tags Date: Thu, 05 Jun 2014 20:50:40 +0900 Message-ID: <87bnu7fucv.fsf@tanger.home> References: <87oay8ez6c.fsf@tanger.home> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:51268) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WsWC3-0002h5-S1 for emacs-orgmode@gnu.org; Thu, 05 Jun 2014 07:50:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WsWBy-00019v-HM for emacs-orgmode@gnu.org; Thu, 05 Jun 2014 07:50:51 -0400 Received: from mail-pd0-x229.google.com ([2607:f8b0:400e:c02::229]:46966) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WsWBy-00019f-6c for emacs-orgmode@gnu.org; Thu, 05 Jun 2014 07:50:46 -0400 Received: by mail-pd0-f169.google.com with SMTP id w10so987321pde.14 for ; Thu, 05 Jun 2014 04:50:45 -0700 (PDT) In-Reply-To: (John Kitchin's message of "Thu, 5 Jun 2014 07:33:20 -0400") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: John Kitchin Cc: "emacs-orgmode@gnu.org" John Kitchin writes: > neat idea. This code does exactly what I need for the completion for a > whole tag query. It should be possible to integrate that into > completion. > > (defun insert-emails-from-tags (tags) > =C2=A0 (interactive "sTags: ") > =C2=A0 (insert > =C2=A0=C2=A0 (save-window-excursion > =C2=A0=C2=A0=C2=A0=C2=A0 (find-file "contacts-bbdb.org") > =C2=A0=C2=A0=C2=A0=C2=A0 (mapconcat > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 'identity > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (let ((todo-only nil)) > =C2=A0=C2=A0=C2=A0 (org-scan-tags > =C2=A0=C2=A0=C2=A0 =C2=A0(lambda () > =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0 (org-entry-get (point) "EMAIL")) ; action > =C2=A0=C2=A0=C2=A0 =C2=A0(cdr (org-make-tags-matcher tags)) ; matcher > =C2=A0=C2=A0=C2=A0 =C2=A0nil)) ", ")))) > > It should be possible to integrate this into the org-contacts database > to get this with completion. I will look into this later today. Thanks > for the ideas. The completion for group based on tags is done in the function `org-contacts-complete-group'. It's been a long time since I played with the completion mechanism, so I don't remember exactly how it worked. Maybe you can replace the mapcar with your function, but it might a bit more tricky than that, especially to handle empty result. Thanks for your work :) Best, --=20 Daimrod/Greg