Add: org-ql-dblock-defaults custom variable
This commit is contained in:
parent
fd31916319
commit
faffed5a4a
1 changed files with 14 additions and 8 deletions
|
|
@ -67,6 +67,12 @@ directories, etc, which would make it slow to list the
|
||||||
`org-directory' files recursively."
|
`org-directory' files recursively."
|
||||||
:type 'boolean)
|
:type 'boolean)
|
||||||
|
|
||||||
|
(defcustom org-ql-dblock-defaults
|
||||||
|
(list :columns '(heading todo (priority "P"))
|
||||||
|
:subtrees t)
|
||||||
|
"Default parameters of org-ql dynamic blocks."
|
||||||
|
:type 'plist)
|
||||||
|
|
||||||
;;;; Commands
|
;;;; Commands
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
|
|
@ -271,13 +277,13 @@ Valid parameters include:
|
||||||
For example, an org-ql dynamic block header could look like:
|
For example, an org-ql dynamic block header could look like:
|
||||||
|
|
||||||
#+BEGIN: org-ql :query (todo \"UNDERWAY\") :columns (priority todo heading) :sort (priority date) :ts-format \"%Y-%m-%d %H:%M\""
|
#+BEGIN: org-ql :query (todo \"UNDERWAY\") :columns (priority todo heading) :sort (priority date) :ts-format \"%Y-%m-%d %H:%M\""
|
||||||
(-let* (((&plist :query :columns :sort :ts-format :take :skip-subtrees) params)
|
(-let* (((&plist :query :columns :sort :ts-format :take :subtrees)
|
||||||
|
(org-combine-plists org-ql-dblock-defaults params))
|
||||||
(query (cl-etypecase query
|
(query (cl-etypecase query
|
||||||
(string (org-ql--query-string-to-sexp query))
|
(string (org-ql--query-string-to-sexp query))
|
||||||
(list ;; SAFETY: Query is in sexp form: ask for confirmation, because it could contain arbitrary code.
|
(list ;; SAFETY: Query is in sexp form: ask for confirmation, because it could contain arbitrary code.
|
||||||
(org-ql--ask-unsafe-query query)
|
(org-ql--ask-unsafe-query query)
|
||||||
query)))
|
query)))
|
||||||
(columns (or columns '(heading todo (priority "P"))))
|
|
||||||
;; MAYBE: Custom column functions.
|
;; MAYBE: Custom column functions.
|
||||||
(format-fns
|
(format-fns
|
||||||
;; NOTE: Backquoting this alist prevents the lambdas from seeing
|
;; NOTE: Backquoting this alist prevents the lambdas from seeing
|
||||||
|
|
@ -304,12 +310,12 @@ For example, an org-ql dynamic block header could look like:
|
||||||
(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)
|
||||||
:where query
|
:where query
|
||||||
:select (if skip-subtrees
|
:select (if subtrees
|
||||||
|
'(org-element-headline-parser
|
||||||
|
(line-end-position))
|
||||||
'(prog1 (org-element-headline-parser
|
'(prog1 (org-element-headline-parser
|
||||||
(line-end-position))
|
(line-end-position))
|
||||||
(org-end-of-subtree t t))
|
(org-end-of-subtree t t)))
|
||||||
'(org-element-headline-parser
|
|
||||||
(line-end-position)))
|
|
||||||
:order-by sort)))
|
:order-by sort)))
|
||||||
(when take
|
(when take
|
||||||
(setf elements (cl-etypecase take
|
(setf elements (cl-etypecase take
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue