Docs: Add org-ql-view example
This commit is contained in:
parent
df8a155b14
commit
aea37ea1c1
1 changed files with 27 additions and 1 deletions
28
examples.org
28
examples.org
|
|
@ -1,5 +1,32 @@
|
||||||
* Examples
|
* Examples
|
||||||
|
|
||||||
|
** Stored views command
|
||||||
|
|
||||||
|
This defines a simple list of stored views and a command to easily access them with completion, which may be more convenient than defining a command for each view.
|
||||||
|
|
||||||
|
#+BEGIN_SRC elisp
|
||||||
|
(defun org-ql-view (&optional view)
|
||||||
|
"Choose and display a stored `org-ql' view."
|
||||||
|
(interactive (list (completing-read "View: " (mapcar #'car org-ql-views))))
|
||||||
|
(funcall (alist-get view org-ql-views nil nil #'string=)))
|
||||||
|
|
||||||
|
(setq org-ql-views
|
||||||
|
(list (cons "Stuck Projects" (lambda ()
|
||||||
|
(org-ql-agenda (org-agenda-files)
|
||||||
|
(and (todo)
|
||||||
|
(not (todo "TO-WATCH" "TO-READ" "MAYBE" "SOMEDAY"))
|
||||||
|
(children)
|
||||||
|
(not (children (todo)))
|
||||||
|
(not (habit)))
|
||||||
|
:title "Stuck Projects"
|
||||||
|
:sort (priority date)
|
||||||
|
:super-groups ((:name "Home" :tag "home")
|
||||||
|
(:tag ("Emacs" "computer") :order 100)
|
||||||
|
(:auto-parent t)
|
||||||
|
(:todo "WAITING")
|
||||||
|
(:auto-category t)))))))
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
** Show entries with timestamps in the last N days
|
** Show entries with timestamps in the last N days
|
||||||
|
|
||||||
#+BEGIN_SRC elisp
|
#+BEGIN_SRC elisp
|
||||||
|
|
@ -28,7 +55,6 @@
|
||||||
;; Show entries closed in last 7 days:
|
;; Show entries closed in last 7 days:
|
||||||
(org-ql-agenda-last-days 30 'closed)
|
(org-ql-agenda-last-days 30 'closed)
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
** Listing bills coming due
|
** 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.
|
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.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue