1

To aid minuting staff meetings in a small organisation, I considered creating a property called :Attendees: and defining the allowed values for that property, e.g.:

* Meetings
       :PROPERTIES:
       :Attendees_ALL: Amy Bob Joe Max Sam Zoe
       :END:

and then using them like this:

** Meeting 2017-05-17
       :PROPERTIES:
       :Attendees: Amy Joe Zoe
       :END:

However, I then spotted that "a property can only have one entry per Drawer." So, Org-mode properties might not be a suitable tool for this after all.

I could use a simple list, I suppose, but I want to easily be able to create sparse trees matching who was at a meeting.

Using tags is also an option, but would be quite intrusive: potentially quite a long list of tags for each meeting. And not easily extendable to "Apologies", i.e. people who could not attend.

What might be a better solution?

  • I haven't tried this, but it seems to me that if only one entry is allowed (and I'm taking your word for it), then one entry might be a list: '(Amy Bob Joe Max Sam Zoe)? I have no idea if we need double-quotes around each name, but I suspect it will be sufficient to use things like (format "%s") to convert when extracting to avoid things like a void variable, etc. ... It may be fairly easy to treat everything in the property drawer as one entry, but I haven't looked at the applicable code. – lawlist May 19 '17 at 14:33
2

You can use exactly what you are trying to do like this.

Use regular expressions like this in your match expressions: Attendees={Joe\|Bob} to see meetings attended by Joe or Bob, or Attendees={Joe}-Attendees={Max} to see meetings attended by Joe and not Max.

Assuming you put an id like this in your heading with all the attendees (so you can retrieve them all later):

* Meetings
       :PROPERTIES:
       :CUSTOM_ID: main
       :Attendees_ALL: Amy Bob Joe Max Sam Zoe
       :END:

You can use a function like this:

#+BEGIN_SRC emacs-lisp
(require 'dash)
(defun absent ()
  "Determine who was absent from the meeting."
  (interactive)
  (message "%s"
       (-difference
        (save-excursion
          (org-open-link-from-string "[[#main]]")
          (org-entry-get-multivalued-property nil "Attendees_ALL"))
        (org-entry-get-multivalued-property nil "Attendees"))))
#+END_SRC

to find who is absent.

  • Thanks :) Unfortunately, in Spacemacs, M-x org-sparse-tree RET r Attendees={Joe\|Bob} RET yields 0 match(es) for regexp Attendees={Joe\|Bob}, even if the file contains entries with property drawers containing, e.g. Attendees: Amy Joe Bob. Was org-sparse-tree the command you had in mind for use with the match expressions you described? – sampablokuper May 23 '17 at 21:42
  • You want =M-x org-sparse-tree RET m Attendees={Joe\|Bob} RET=. The key is to do a "match" on the tags/properties. I think r probably does a regex match on the headings. – John Kitchin May 24 '17 at 11:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.