Add: (org-ql-query) narrow, order-by

This commit is contained in:
Adam Porter 2019-08-10 10:18:03 -05:00
parent bd3ab6fb02
commit ab0df68aae
2 changed files with 16 additions and 4 deletions

View file

@ -286,7 +286,7 @@ Examples:
**** Function: ~org-ql-query~ **** Function: ~org-ql-query~
/Arguments:/ ~(&key (select 'element-with-markers) from where)~ /Arguments:/ ~(&key (select 'element-with-markers) from where order-by narrow)~
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.
@ -296,6 +296,11 @@ Like ~org-ql-select~, but arguments are named more like a ~SQL~ query.
~WHERE~ corresponds to the ~org-ql-select~ argument ~QUERY~. ~WHERE~ corresponds to the ~org-ql-select~ argument ~QUERY~.
~ORDER-BY~ corresponds to the ~org-ql-select~ argument ~SORT~, which
see.
~NARROW~ corresponds to the ~org-ql-select~ argument ~NARROW~.
Examples: Examples:
#+BEGIN_SRC elisp #+BEGIN_SRC elisp

View file

@ -196,7 +196,7 @@ non-nil."
((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, or one or a list of the defined sorting methods (see documentation)")))))
(cl-defun org-ql-query (&key (select 'element-with-markers) from where) (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.
SELECT corresponds to the `org-ql-select' argument ACTION. It is SELECT corresponds to the `org-ql-select' argument ACTION. It is
@ -219,10 +219,17 @@ FROM corresponds to the `org-ql-select' argument BUFFERS-OR-FILES.
It may be one or a list of file paths and/or buffers. It may be one or a list of file paths and/or buffers.
WHERE corresponds to the `org-ql-select' argument QUERY. It WHERE corresponds to the `org-ql-select' argument QUERY. It
should be an `org-ql' query sexp." should be an `org-ql' query sexp.
ORDER-BY corresponds to the `org-ql-select' argument SORT, which
see.
NARROW corresponds to the `org-ql-select' argument NARROW."
(declare (indent defun)) (declare (indent defun))
(org-ql-select from where (org-ql-select from where
:action select)) :action select
:narrow narrow
:sort sort))
(defun org-ql--pre-process-query (query) (defun org-ql--pre-process-query (query)
"Return QUERY having been pre-processed. "Return QUERY having been pre-processed.