diff --git a/README.org b/README.org index 45bcbd2..3cbc1e9 100644 --- a/README.org +++ b/README.org @@ -474,6 +474,7 @@ Expands into a call to ~org-ql-select~ with the same arguments. For convenience + Don't overwrite bindings in =org-agenda-mode-map=. + Don't search buffers without headings, and show a message if the user attempts it. + Don't search hidden/special buffers. ++ Properly accept arbitrary sort functions in =org-ql-select=, etc. (Fixes [[https://github.com/alphapapa/org-ql/issues/37][#37]]. Thanks to [[https://github.com/mz-pdm][Milan Zamazal]].) *Compatibility* + Fixes for compatibility with Org 9.2. (Thanks to [[https://github.com/ataias][Ataias Pereira Reis]] and [[https://github.com/dakra][Daniel Kraus]].) diff --git a/org-ql.el b/org-ql.el index 8f6f954..59215f7 100644 --- a/org-ql.el +++ b/org-ql.el @@ -217,15 +217,14 @@ non-nil." ;; Sort items (pcase sort (`nil items) - ((guard (and sort - (setq sort (-list sort)) - (cl-loop for elem in sort - always (memq elem '(date deadline scheduled todo priority))))) + ((or 'date 'deadline 'scheduled 'todo 'priority + (guard (cl-loop for elem in sort + always (memq elem '(date deadline scheduled todo priority))))) ;; Default sorting functions - (org-ql--sort-by items sort)) + (org-ql--sort-by items (-list sort))) ;; Sort by user-given comparator. ((pred functionp) (sort items sort)) - (_ (user-error "SORT must be either nil, or one or a list of the defined sorting methods (see documentation)"))))) + (_ (user-error "SORT must be either nil, one or a list of the defined sorting methods (see documentation), or a comparison function of two arguments"))))) (cl-defun org-ql-query (&key (select 'element-with-markers) from where narrow order-by) "Like `org-ql-select', but arguments are named more like a SQL query.