From: Ihor Radchenko <yantar92@posteo.net>
To: Morgan Smith <Morgan.J.Smith@outlook.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: [PATCH] Testing: Add tests for `org-tags-sort-function'
Date: Sun, 01 Sep 2024 13:33:32 +0000 [thread overview]
Message-ID: <8734mj8pn7.fsf@localhost> (raw)
In-Reply-To: <CH3PR84MB342464F6458F91EE5800545AC5C32@CH3PR84MB3424.NAMPRD84.PROD.OUTLOOK.COM>
Morgan Smith <Morgan.J.Smith@outlook.com> writes:
> diff --git a/testing/lisp/test-org-agenda.el b/testing/lisp/test-org-agenda.el
> index 778f91e8e..c1092df3b 100644
> --- a/testing/lisp/test-org-agenda.el
> +++ b/testing/lisp/test-org-agenda.el
Thanks for the patch!
> + ;; 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.
> + (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.
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.
> + ((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.
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
next prev parent reply other threads:[~2024-09-01 13:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-15 15:27 [PATCH] Testing: Add tests for `org-tags-sort-function' Morgan Smith
2024-09-01 13:33 ` Ihor Radchenko [this message]
2024-09-02 18:36 ` Morgan Smith
[not found] ` <875xrdzyvs.fsf@outlook.com>
2024-12-11 0:05 ` Morgan Smith
2024-12-24 12:25 ` Ihor Radchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8734mj8pn7.fsf@localhost \
--to=yantar92@posteo.net \
--cc=Morgan.J.Smith@outlook.com \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).