[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] lisp/org.el: Add ability to sort tags by hierarchy
From: |
Morgan Smith |
Subject: |
Re: [PATCH] lisp/org.el: Add ability to sort tags by hierarchy |
Date: |
Tue, 24 Dec 2024 16:48:12 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Hello!
I have updated the patch with many improvements and tests.
Ihor Radchenko <yantar92@posteo.net> writes:
> Morgan Smith <Morgan.J.Smith@outlook.com> writes:
>
>> * lisp/org.el (org-tags-sort-hierarchy): New function.
>> (org-tags-sort-function): Add new function to type.
>> * testing/lisp/test-org.el (test-org/tags-sort-hierarchy): New test
>> ---
>>
>> This is one of those things that I thought would be easy but then ended up
>> hard.
>>
>> I wrote this so that items in my agenda would sort nicely. Items tagged in
>> the
>> same hierarchy would end up next to each other.
>
>> + "Sort tags TAG1 and TAG2 by the tag hierarchy.
>> +Sorting is done alphabetically. This function is intended to be a value
>> +of `org-tags-sort-function'."
>
> Thanks for the patch, but may you please elaborate what kind of sorting
> order does your function imply? In particular, I am wondering about the
> ordering of tags from different groups?
Hopefully the test case I added shows how the sorting work. The tags
end up sorted as this:
("group_a" "tag_a_1" "tag_a_2" "groupless" "lonely" "tag_b_1" "tag_b_2")
Things end up with other things of their group. Things higher in the
heirarchy end up earlier. When things are on the same level (like
tag_a_1 and tag_a_2 or group_a and groupless) they are sorted using
`org-sort-function'.
> Also, what happens when there
> are no tag groups defined? (These questions should be answered in the
> docstring and the etc/ORG-NEWS entry you need to add, announcing the new
> feature)
Fallback to `org-sort-function'.
> Also, sorting may not be alphabetical, depending on the value of
> `org-sort-function'.
I have corrected this in the documentation.
0001-lisp-org.el-Add-ability-to-sort-tags-by-hierarchy.patch
Description: Text Data
- Re: [PATCH] lisp/org.el: Add ability to sort tags by hierarchy,
Morgan Smith <=