org-ql icon indicating copy to clipboard operation
org-ql copied to clipboard

Add: (property) :multi argument

Open SqrtMinusOne opened this issue 1 year ago • 2 comments

This adds the :multi argument to the property predicate.

E.g. for the following case:

* Test 1
:PROPERTIES:
:PROP:     value-1
:PROP+:     value-2
:PROP+:     value-3
:END:

* Test 2
:PROPERTIES:
:PROP:     value-2
:END:
  • (property "PROP" "value-2") returns just Test 2
  • (property "PROP" "value-2" :multi t) returns both Test 1 and Test 2

SqrtMinusOne avatar Oct 22 '23 18:10 SqrtMinusOne

Hello,

Thanks for submitting this. This would be a good feature to support.

It should be noted that this PR is intended to address https://github.com/alphapapa/org-ql/issues/254.

A few questions:

  1. Have you signed the FSF copyright assignment for Emacs/Org, or would you be willing to? I'm trying to keep Org QL suitable for inclusion in GNU ELPA or Org itself.
  2. The Org manual at (info "(org) Property Syntax") says: "Note that a property can only have one entry per drawer." So it's unclear to me whether a property value can be added to multiple times in a single entry. Do you know anything about that?
  3. Before support for this feature could be merged, any patch would need to include tests.

Thanks.

alphapapa avatar Oct 23 '23 06:10 alphapapa

Hello.

  1. Ah, unfortunately not. I wonder if I can even pull this off... if this requires convincing my university that I have something to do with a US-based nonprofit, much less an explicitly political nonprofit. Maybe I'll ask around, but I guess this puts the PR on hold if there's no other way.
  2. Hmm, that's strange. The same manual page says: "If you want to add to the value of an existing property, append a ‘+’ to the property name". And then "It is also possible to add to the values of inherited properties.". So if adding values to inherited properties isn't the only use case, where would the additional entry be if not in the same drawer? Anyway, org-contacts supports adding emails like this.
  3. I see. I'll add tests if there's any chance this can be merged.

SqrtMinusOne avatar Oct 23 '23 14:10 SqrtMinusOne