This commit is contained in:
libanp 2026-07-03 23:20:40 +00:00 committed by GitHub
commit d456419cd0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -287,18 +287,37 @@ Valid parameters include:
form.
: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\").
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', `priority', `deadline', `scheduled',
`closed', `custom'. 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 a `custom' column, the first argument is a
function, followed by any arguments to that
function. A header string is required:
((custom my-func \"arg\") \"MyHeading\").
The custom function must return a string.
Note that the first argument passed to the custom
function will be the Org element of the matched
heading. So the function above will run as:
(my-func element \"arg\")
The alist of column lambdas in this function are
useful starting points for writing your own custom
column functions.
:sort One or a list of Org QL sorting methods
(see `org-ql-select').
@ -345,7 +364,13 @@ this (must be a single line in the Org buffer):
(--when-let (org-element-property :closed element)
(ts-format ts-format (ts-parse-org-element it)))))
(cons 'property (lambda (element property)
(org-element-property (intern (concat ":" (upcase property))) element)))))
(org-element-property (intern (concat ":" (upcase property))) element)))
(cons 'custom (lambda (element func &rest args)
(let ((result (apply func element args)))
(if (stringp result)
result
(error "org-dblock-write:org-ql: Custom column %s must return a string"
(if (symbolp func) func "lambda"))))))))
(elements (org-ql-query :from (current-buffer)
:where query
:select '(org-ql-view--resolve-element-properties