I've attached an updated patch. This one has a test where we actually don't sort tags by using the `ignore' function. Ihor Radchenko writes: >> + ;; Sorting doesn't care about `org-tag-alist'. This is only >> + ;; here for later when we add sorting methods that do >> .... > > Then, please refrain from setting alist in this patch and add it later, > when testing the relevant methods. Done. Now my tag names don't really make sense but I suppose that's not a big issue. >> + (org-test-agenda-with-agenda >> + (string-join >> + '("* TODO group_a :group_a:" >> + "* TODO tag_a_1 :tag_a_1:" >> + "* TODO tag_a_2 :tag_a_2:" >> + "* TODO tag_b_1 :tag_b_1:" >> + "* TODO tag_b_2 :tag_b_2:" >> + "* TODO groupless :groupless:" >> + "* TODO lonely :lonely:") >> + "\n") >> + (dolist (org-tags-sort-function '(nil org-string< org-string>)) >> + (should >> + (string-equal >> + (progn >> + (org-agenda nil "f") >> + (substring-no-properties (buffer-string))) >> + (pcase org-tags-sort-function >> + ;; TODO: a value of `nil' sorts it! That's not what the >> + ;; customize menu of `org-tags-sort-function' says! It >> + ;; says "No sorting". > > Right. When sort function is not set agenda specifically (but not other > users of org-tags-sort-function) falls back to alphabetical sorting. As far as I can tell the only place where it doesn't fall back is in `org-set-tags'. > In fact, the docstring does not at all mention that > `org-tags-sort-function' is honored at all: > > (defcustom org-agenda-sorting-strategy ... > ... > tag-up Sort alphabetically by last tag, A-Z. > tag-down Sort alphabetically by last tag, Z-A. > > We need to fix this docstring documenting `org-tags-sort-function', I think. I don't understand what is happening in `org-entries-lessp' or how it even manages to use `org-agenda-sorting-strategy' so I'm going to refrain from trying to document things I don't understand. >> + ((or 'nil 'org-string<) >> + "group_a\ngroupless\nlonely\ntag_a_1\ntag_a_2\ntag_b_1\ntag_b_2\n") >> + ('org-string> >> + "tag_b_2\ntag_b_1\ntag_a_2\ntag_a_1\nlonely\ngroupless\ngroup_a\n")))))))) > > Nitpick: it would be more readable to use `string-join' here as well. Done