2.3 KiB
2.3 KiB
org-ql examples
Show entries with recent timestamps
You can also access these views with the command org-ql-view.
;; Show entries with any timestamp from last 7 days:
(org-ql-view-recent-items 7)
;; Show entries clocked in last 30 days:
(org-ql-view-recent-items 30 'clocked)
;; Show entries closed in last 30 days:
(org-ql-view-recent-items 30 'closed)
Stuck projects block agenda
Reddit user emptymatrix shared this example of replacing a traditional org-stuck-projects view like:
(setq org-stuck-projects
'("+@project/-DONE" ("NEXT") nil "SCHEDULED:"))
With this org-ql-block agenda view, like:
(setq org-agenda-custom-commands
'(("s" "Stuck Projects"
((org-ql-block '(and (tags "@project")
(not (done))
(not (descendants (todo "NEXT")))
(not (descendants (scheduled)))))))))
Listing bills coming due
This uses the example in the readme file, but maps across the elements returned by org-ql to present a simple list of titles and deadlines.
(org-ql (org-agenda-files)
(and (not (done))
(tags "bills")
(deadline auto))
:action (list (substring-no-properties (org-get-heading t t))
(org-entry-get (point) "DEADLINE"))
:sort deadline)
;;=> (("Electric bill" "<2018-08-23 Thu +1m>")
;; ("Rent" "<2018-09-01 Sat +1m>"))
This could also be put in a script, which could use desktop notifications to remind of bills coming due: org-bills-due.el.