From aea37ea1c104db3dc462ac8d95fe39efa5f6076a Mon Sep 17 00:00:00 2001 From: Adam Porter Date: Tue, 13 Aug 2019 21:10:42 -0500 Subject: [PATCH] Docs: Add org-ql-view example --- examples.org | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/examples.org b/examples.org index 233bd1c..e2de499 100644 --- a/examples.org +++ b/examples.org @@ -1,5 +1,32 @@ * 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 #+BEGIN_SRC elisp @@ -28,7 +55,6 @@ ;; Show entries closed in last 7 days: (org-ql-agenda-last-days 30 'closed) #+END_SRC - ** 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.