emacs-orgmode
[Top][All Lists]
Advanced

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

Re: agenda-view: match tags: Sorting by number of tags matched?


From: Budiman Snowman
Subject: Re: agenda-view: match tags: Sorting by number of tags matched?
Date: Thu, 4 Jun 2020 22:22:48 +0700

On Thu, Jun 4, 2020 at 11:31 AM Kyle Meyer <kyle@kyleam.com> wrote:
Budiman Snowman writes:

> Suppose I have this document:
>
> * topic1                                               :tag1:tag2:tag3:
> * topic2                                               :tag1:tag2:tag4:
> * topic3                                               :tag1:tag3:tag4:
> * topic4                                               :tag2:tag3:tag4:
> * topic5                                               :tag1:tag2:
> * topic6                                               :tag1:tag4:
> * topic7                                               :tag3:tag4:
> * topic8                                               :tag1:
>
> And I turn on org-agenda m, then search for tag1|tag3|tag4. Emacs will then
> show the results (all entries match) in the above order.

org-agenda-sorting-strategy is the main option that controls sorting in
the agenda.  Going through the values there, I don't see anything
fitting your description.  But there is a user-defined-{up,down} option
that lets you implement your own logic via org-agenda-cmp-user-defined.
Here's an example.  It's probably brittle and inefficient in a number of
ways (and maybe completely wrong), but hopefully it gives you something
to start with.
<snip>

Thanks! I'll play with it later.

> * topic2                                               :tag1:tag2:tag4:
> * topic1                                               :tag1:tag2:tag3:
> * topic3                                               :tag1:tag3:tag4:
> * topic4                                               :tag2:tag3:tag4:
> * topic6                                               :tag1:tag4:
> * topic5                                               :tag1:tag2:
> * topic7                                               :tag3:tag4:
> * topic8                                               :tag1:

Hmm, your example query is "tag1|tag3|tag4", so a few of those lines
seem off.  For example, shouldn't topic 3 be at the top? 

Ah yes, I wrote incorrectly, I thought I wrote the query "tag1|tag2|tag4". You understood my goal perfectly.

Regards,
BS

reply via email to

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