Notes: Add to idea
This commit is contained in:
parent
df1209dbab
commit
693f52edef
1 changed files with 38 additions and 0 deletions
38
notes.org
38
notes.org
|
|
@ -36,6 +36,44 @@ e.g. as mentioned by Samuel Wales at https://lists.gnu.org/archive/html/emacs-or
|
|||
|
||||
(org-ql-timeline (org-agenda-files)
|
||||
'(and "Emacs" (ts)))
|
||||
|
||||
;; More timeline-like version, organized by date rather than task.
|
||||
|
||||
(cl-defun org-ql-timeline* (buffers-files query &key filter-ts)
|
||||
(let* ((ts-ht (ht))
|
||||
(results (org-ql-select buffers-files
|
||||
query
|
||||
:action (lambda ()
|
||||
(let* ((heading-string
|
||||
(->> (org-element-headline-parser
|
||||
(line-end-position))
|
||||
org-ql--add-markers
|
||||
org-ql-agenda--format-element))
|
||||
(date-timestamps
|
||||
;; Each one set to 00:00:00.
|
||||
(cl-loop with limit = (org-entry-end-position)
|
||||
while (re-search-forward org-ts-regexp-both
|
||||
limit t)
|
||||
collect (->> (match-string 0)
|
||||
ts-parse-org
|
||||
(ts-apply :hour 0 :minute 0 :second 0)))))
|
||||
(setf date-timestamps (delete-dups date-timestamps))
|
||||
(when filter-ts
|
||||
(setf date-timestamps (cl-remove-if-not filter-ts date-timestamps)))
|
||||
(--each date-timestamps
|
||||
(push heading-string (gethash it ts-ht)))))))
|
||||
(tss-sorted (-sort #'ts< (ht-keys ts-ht)))
|
||||
(strings (cl-loop for ts in tss-sorted
|
||||
collect (concat "\n"
|
||||
(propertize (ts-format "%Y-%m-%d" ts)
|
||||
'face 'org-agenda-structure))
|
||||
append (ht-get ts-ht ts))))
|
||||
(org-ql-agenda--agenda nil nil :strings strings)))
|
||||
|
||||
(org-ql-timeline* (org-agenda-files)
|
||||
'(ts :from -14)
|
||||
:filter-ts `(lambda (ts)
|
||||
(ts<= ,(ts-adjust 'day -14 (ts-now)) ts)))
|
||||
#+END_SRC
|
||||
|
||||
** TODO [#A] Outline path in buffers-files arg
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue