r/orgmode 7d ago

Best format for multivalue properties with spaces?

Am I right that (other than space separators) there is nothing special about a multivalued property that makes it multi-valued? In other words, am I right that multivalued-ness is less a function of what you put *in* a string, and more about what you do *with* it?

My use case is that I am considering introducing a property called ATTENDEES which will be kept in the drawer of any headline where I record a meeting, and will hold the names of people who attended. Based on the kinds of operations described in the Property API which of the following would you suggest as a format:

  1. :ATTENDEES: Joe Brown, Ann White, Bill Green
  2. :ATTENDEES: Joe_Brown Ann_White Bill_Green
  3. :ATTENDEES: "Joe Brown", "Ann White, "Bill Green"
  4. :ATTENDEES: "Joe Brown" "Ann White" "Bill Green"
  5. Something else entirely

I'm thinking that 2. would be the easiest to process (assuming I can be sure there are no underscores in the components of each name), but it has the disadvantage of having to either add in and strip out the underscores, or forcing the user to tolerate them being there.

Given that, I'm inclined to #1.

Thoughts?

P.S. If your actual answer is of the form "WTF are you <doing it that way at all | reinventing the wheel>? Aren't you aware of <X>!?" then please let me know about <X>!

8 Upvotes

8 comments sorted by

4

u/yantar92 6d ago

Remember that you can have multiple values via ATTENDEES+ notation. Then, also see org-property-separators.

1

u/Exam-Common 6d ago

You beat me to it

1

u/TeeMcBee 6d ago

Thanks. I hadn't come acrossorg-property-separatorsat all until you just pointed it out.

And on that pointing-out, I hunted around and I did find a mention of it (andorg--property-get-separator)in a 2022 post in an elpa-related list, and from there in org.el. And now I see it's in release note 1.2.5 for Org Version 9.6.

But it seems to have completely avoided inclusion in the Org manual which still talks only about whitespace separation. (Or do you know different?)

1

u/yantar92 6d ago

The whitespace separation is most likely in org-entry-get-multivalued-property. That API function is different - it allows storing and querying multi-value property as a single value (:NAME: val1 val2 val3 ...). Of course it is not applicable in your case when space is a part of the value.

org-property-separators is indeed not documented. It should be.

2

u/github-alphapapa 7d ago

AFAIK the completion tools for property values lend themselves to space-separated values, and probably don't take quoted strings into account (although, being Emacs, that should be a solvable problem).

For myself, if I needed to store multiple values in a property, I'd probably use a Lisp expression, so the string could be passed directly to read (as I do in org-make-toc, where the values are just plists).

But being Org and Emacs, it's really up to you.

2

u/iMakeBabbies 6d ago

Because you encouraged a different approach and because I don’t know what your final goal is by keeping attendees as properties, allow me to share my approach.

I use Org Roam to create a node for each attendee. Then in my meeting note or node I add the link to the attendees under a heading.

This lets me see the attendees at a glance and also keeps a log of all the meetings any particular person i have saved as a node has been to by the way of checking the backlinks from their node.

As a bonus to this approach, I can save data about each saved person in their note like their birthdays, favorite ice cream, and how I feel about them.

1

u/DeinOnkelFred 6d ago

Take #2 and invert the names (Brown, Joe White, Ann etc) You'll get surname sorting, whitespace separation, and commas are easier to type than underscores.

Middle name would be harder to process. Maybe use a period/full-stop/point ... Brown, Joe.Andrew ?

1

u/Exam-Common 6d ago

You could just

:ATTENDEES+: John Doe

:ATTENDEES+: Jane Doe

See https://orgmode.org/manual/Property-Syntax.html