emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] org-contacts email completion by tags


From: John Kitchin
Subject: Re: [O] org-contacts email completion by tags
Date: Thu, 5 Jun 2014 12:54:19 -0400


On Thu, Jun 5, 2014 at 7:50 AM, Daimrod <address@hidden> wrote:
org-contacts-complete-group

Here is a better function I think. It uses the builtin org-contacts database:

(defun insert-emails-from-tags (tag-_expression_)
  "insert emails from org-contacts that match the tags _expression_. For example:
group-phd will match entries tagged with group but not with phd."
  (interactive "sTags: ")
  (insert
   (mapconcat 'identity
          (loop for contact in (org-contacts-filter)
            for contact-name = (car contact)
            for email = (org-contacts-strip-link (car (org-contacts-split-property
                                   (or
                                (cdr (assoc-string org-contacts-email-property
                                           (caddr contact)))
                                ""))))
            for tags = (cdr (assoc "TAGS" (nth 2 contact)))
            for tags-list = (if tags
                    (split-string (substring (cdr (assoc "TAGS" (nth 2 contact))) 1 -1) ":")
                      '())
            if (let ((todo-only nil))
             (eval (cdr (org-make-tags-matcher tag-_expression_))))
           
            collect (org-contacts-format-email contact-name email))
          ",")))


John

-----------------------------------
John Kitchin
Associate Professor
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
http://kitchingroup.cheme.cmu.edu


reply via email to

[Prev in Thread] Current Thread [Next in Thread]