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 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]].)
|
||||
|
|
|
|||
11
org-ql.el
11
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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue