From ab0df68aae4f7558d47276f9758e9a7681b4d649 Mon Sep 17 00:00:00 2001 From: Adam Porter Date: Sat, 10 Aug 2019 10:18:03 -0500 Subject: [PATCH] Add: (org-ql-query) narrow, order-by --- README.org | 7 ++++++- org-ql.el | 13 ++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/README.org b/README.org index f6b3193..9bcb3f5 100644 --- a/README.org +++ b/README.org @@ -286,7 +286,7 @@ Examples: **** 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. @@ -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~. +~ORDER-BY~ corresponds to the ~org-ql-select~ argument ~SORT~, which +see. + +~NARROW~ corresponds to the ~org-ql-select~ argument ~NARROW~. + Examples: #+BEGIN_SRC elisp diff --git a/org-ql.el b/org-ql.el index 24d6d2c..dcc6321 100644 --- a/org-ql.el +++ b/org-ql.el @@ -196,7 +196,7 @@ non-nil." ((pred functionp) (sort items sort)) (_ (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. 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. 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)) (org-ql-select from where - :action select)) + :action select + :narrow narrow + :sort sort)) (defun org-ql--pre-process-query (query) "Return QUERY having been pre-processed.