I want to implement an
org-agenda-cmp-user-defined for use with
In order to do that, I have two lists of tags I need to compare, from the two items to be sorted passed to
org-agenda-cmp-user-defined. I want the function to compare based on a particular order of tags, say:
("spam" "ham" "eggs")
So that the items are sorted by whether they have tag "spam" first, then breaking ties by whether they have tag "ham", etc.
How can I do that, in good elisp style? I'd like it to be reasonably CPU-efficient, since org-agenda already does quite a bit of work building its views.
I'm aware that org agenda has a built-in way of sorting based on the first tag on each item: note this is different from that behaviour.
For example, these sets of tags are sorted according to the priority list above (
("lettuce" "spam") are equal for sorting purposes, the others are all distinct for sorting purposes):
("spam" "ham" "eggs") ("spam" "ham") ("spam") ("lettuce" "spam") ("ham") ("eggs") nil
org-agenda-cmp-user-defined would see only one pair of these values at a time.