Fix: (org-ql-select) Properly accept arbitrary sort function
Fixes #37. Thanks to Milan Zamazal (@mz-pdm).
This commit is contained in:
parent
c576813fc8
commit
f26052eb79
2 changed files with 6 additions and 6 deletions
|
|
@ -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 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 buffers without headings, and show a message if the user attempts it.
|
||||||
+ Don't search hidden/special buffers.
|
+ 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*
|
*Compatibility*
|
||||||
+ Fixes for compatibility with Org 9.2. (Thanks to [[https://github.com/ataias][Ataias Pereira Reis]] and [[https://github.com/dakra][Daniel Kraus]].)
|
+ Fixes for compatibility with Org 9.2. (Thanks to [[https://github.com/ataias][Ataias Pereira Reis]] and [[https://github.com/dakra][Daniel Kraus]].)
|
||||||
|
|
|
||||||
|
|
@ -217,15 +217,14 @@ non-nil."
|
||||||
;; Sort items
|
;; Sort items
|
||||||
(pcase sort
|
(pcase sort
|
||||||
(`nil items)
|
(`nil items)
|
||||||
((guard (and sort
|
((or 'date 'deadline 'scheduled 'todo 'priority
|
||||||
(setq sort (-list sort))
|
(guard (cl-loop for elem in sort
|
||||||
(cl-loop for elem in sort
|
|
||||||
always (memq elem '(date deadline scheduled todo priority)))))
|
always (memq elem '(date deadline scheduled todo priority)))))
|
||||||
;; Default sorting functions
|
;; Default sorting functions
|
||||||
(org-ql--sort-by items sort))
|
(org-ql--sort-by items (-list sort)))
|
||||||
;; Sort by user-given comparator.
|
;; Sort by user-given comparator.
|
||||||
((pred functionp) (sort items sort))
|
((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)
|
(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.
|
"Like `org-ql-select', but arguments are named more like a SQL query.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue