:link option and file name options
- `:link t` option gives the user an option whether to make the headings a link or not - an element with `:file` to be added via `org-ql.el` - this `:file` will be used here for the file-name with its path
This commit is contained in:
parent
35d305b7f6
commit
f15d0dc76b
1 changed files with 22 additions and 15 deletions
|
|
@ -268,13 +268,15 @@ Valid parameters include:
|
||||||
positive number) or the end (a negative number) of
|
positive number) or the end (a negative number) of
|
||||||
the results.
|
the results.
|
||||||
|
|
||||||
|
:link set this to non-nil for org-links to be there. If you leave this out or to nil, then no links in the headings.
|
||||||
|
|
||||||
:ts-format Optional format string used to format
|
:ts-format Optional format string used to format
|
||||||
timestamp-based columns.
|
timestamp-based columns.
|
||||||
|
|
||||||
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 :file org-agenda-files :query (todo \"UNDERWAY\") :columns (priority todo heading) :sort (priority date) :ts-format \"%Y-%m-%d %H:%M\""
|
#+BEGIN: org-ql :file org-agenda-files :query (todo \"UNDERWAY\") :columns (priority todo heading) :sort (priority date) :link t :ts-format \"%Y-%m-%d %H:%M\""
|
||||||
(-let* (((&plist :query :columns :sort :ts-format :take :file) params)
|
(-let* (((&plist :query :columns :sort :ts-format :take :link :file) 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.
|
||||||
|
|
@ -289,22 +291,27 @@ For example, an org-ql dynamic block header could look like:
|
||||||
(list (cons 'todo (lambda (element)
|
(list (cons 'todo (lambda (element)
|
||||||
(org-element-property :todo-keyword element)))
|
(org-element-property :todo-keyword element)))
|
||||||
(cons 'heading (lambda (element)
|
(cons 'heading (lambda (element)
|
||||||
(org-link-make-string
|
(--when-let (org-element-property :raw-value element)
|
||||||
(format "file:%s::%s"
|
(if (not link) it
|
||||||
(marker-buffer (org-element-property :org-marker element))
|
(let ((search
|
||||||
(org-element-property :raw-value element))
|
(org-link-heading-search-string it)))
|
||||||
;; Prune statistics cookies. Replace
|
(org-link-make-string
|
||||||
;; links with their description, or
|
(format "file:%s::%s" (org-element-property :file element) search)
|
||||||
;; a plain link if there is none.
|
;; Prune statistics cookies. Replace
|
||||||
(org-trim
|
;; links with their description, or
|
||||||
(org-link-display-format
|
;; a plain link if there is none.
|
||||||
(replace-regexp-in-string
|
(org-trim
|
||||||
"\\[[0-9]*\\(?:%\\|/[0-9]*\\)\\]" ""
|
(org-link-display-format
|
||||||
(org-element-property :raw-value element)))))
|
(replace-regexp-in-string
|
||||||
))
|
"\\[[0-9]*\\(?:%\\|/[0-9]*\\)\\]" ""
|
||||||
|
it))))
|
||||||
|
)))))
|
||||||
(cons 'priority (lambda (element)
|
(cons 'priority (lambda (element)
|
||||||
(--when-let (org-element-property :priority element)
|
(--when-let (org-element-property :priority element)
|
||||||
(char-to-string it))))
|
(char-to-string it))))
|
||||||
|
(cons 'closed (lambda (element)
|
||||||
|
(--when-let (org-element-property :closed element)
|
||||||
|
(ts-format ts-format (ts-parse-org-element it)))))
|
||||||
(cons 'deadline (lambda (element)
|
(cons 'deadline (lambda (element)
|
||||||
(--when-let (org-element-property :deadline element)
|
(--when-let (org-element-property :deadline element)
|
||||||
(ts-format ts-format (ts-parse-org-element it)))))
|
(ts-format ts-format (ts-parse-org-element it)))))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue