Add: (closed) column for dynamic block

This commit is contained in:
Jianye Ye 2020-12-28 09:13:39 +08:00 committed by Adam Porter
parent 80970856d6
commit 4646d6d307
2 changed files with 5 additions and 2 deletions

View file

@ -471,7 +471,7 @@ It would be expanded to:
Org QL provides a dynamic block that lists entries in the current document matching a query. In the header, these parameters are supported: Org QL provides a dynamic block that lists entries in the current document matching a query. In the header, these parameters are supported:
+ ~:query~: An Org QL query expression in either sexp or non-sexp form. + ~:query~: An Org QL query expression in either sexp or non-sexp form.
+ ~:columns~ A list of columns, including ~heading~, ~todo~, ~property~, ~priority~, ~deadline~, ~scheduled~. + ~:columns~ A list of columns, including ~heading~, ~todo~, ~property~, ~priority~, ~deadline~, ~scheduled~, ~closed~.
- Each column may also be specified as a list with the second element being a header string. For example, to abbreviate the priority column: ~(priority "P")~. - Each column may also be specified as a list with the second element being a header string. For example, to abbreviate the priority column: ~(priority "P")~.
- For certain columns, like =property=, arguments may be passed by specifying the column type itself as a list. For example, to display a column showing the values of a ~property~ named ~milestone~, with the header being abbreviated to ~M~: ~((property "milestone") "M")~. - For certain columns, like =property=, arguments may be passed by specifying the column type itself as a list. For example, to display a column showing the values of a ~property~ named ~milestone~, with the header being abbreviated to ~M~: ~((property "milestone") "M")~.
+ ~:sort~ One or a list of Org QL sorting methods (see ~org-ql-select~). + ~:sort~ One or a list of Org QL sorting methods (see ~org-ql-select~).

View file

@ -246,7 +246,7 @@ Valid parameters include:
form. form.
:columns A list of columns, including `heading', `todo', :columns A list of columns, including `heading', `todo',
`property', `priority', `deadline', `scheduled'. `property',`priority',`deadline',`scheduled',`closed'.
Each column may also be specified as a list with the Each column may also be specified as a list with the
second element being a header string. For example, second element being a header string. For example,
to abbreviate the priority column: (priority \"P\"). to abbreviate the priority column: (priority \"P\").
@ -297,6 +297,9 @@ For example, an org-ql dynamic block header could look like:
(cons 'scheduled (lambda (element) (cons 'scheduled (lambda (element)
(--when-let (org-element-property :scheduled element) (--when-let (org-element-property :scheduled element)
(ts-format ts-format (ts-parse-org-element it))))) (ts-format ts-format (ts-parse-org-element it)))))
(cons 'closed (lambda (element)
(--when-let (org-element-property :closed element)
(ts-format ts-format (ts-parse-org-element it)))))
(cons 'property (lambda (element property) (cons 'property (lambda (element property)
(org-element-property (intern (concat ":" (upcase property))) element))))) (org-element-property (intern (concat ":" (upcase property))) element)))))
(elements (org-ql-query :from (current-buffer) (elements (org-ql-query :from (current-buffer)