Docs: Add examples and update readme

This commit is contained in:
Adam Porter 2018-07-10 08:38:17 -05:00
parent ed55f7f15f
commit 056c93bcd6
2 changed files with 27 additions and 5 deletions

View file

@ -17,19 +17,19 @@ Here's an example of generating a kind of agenda view for today (note that the g
Here are some other examples: Here are some other examples:
#+BEGIN_SRC elisp #+BEGIN_SRC elisp
;; Show an agenda-like view of items in all agenda files with TODO and SOMEDAY keywords which are ;; Show an agenda-like view of items in "~/org/main.org" with TODO and SOMEDAY keywords which are
;; tagged "computer" or "Emacs" and in the category "main": ;; tagged "computer" or "Emacs" and in the category "main":
(org-agenda-ng org-agenda-files (org-agenda-ng "~/org/main.org"
(and (todo "TODO" "SOMEDAY") (and (todo "TODO" "SOMEDAY")
(tags "computer" "Emacs") (tags "computer" "Emacs")
(category "main"))) (category "main")))
;; Show an agenda-like view of all habits: ;; Show an agenda-like view of all habits in all agenda files:
(org-agenda-ng org-agenda-files (org-agenda-ng
(habit)) (habit))
;; Show an agenda-like view similar to a "traditional" Org agenda: ;; Show an agenda-like view similar to a "traditional" Org agenda:
(org-agenda-ng "~/org/main.org" (org-agenda-ng
(or (habit) (or (habit)
(date = today) (date = today)
(deadline <=) (deadline <=)
@ -38,6 +38,8 @@ Here are some other examples:
(closed = today)))) (closed = today))))
#+END_SRC #+END_SRC
More examples are available in [[examples.org]].
** org-ql ** org-ql
Another way to look at it is like a "query language" for Org buffers. For example: Another way to look at it is like a "query language" for Org buffers. For example:

20
examples.org Normal file
View file

@ -0,0 +1,20 @@
* Examples
** Showing TO-READ entries containing the word "lisp"
This query would be difficult to write in a standard Org Agenda search, because it matches against a to-do keyword /and/ a plain-text search. As described in the [[https://orgmode.org/worg/org-tutorials/advanced-searching.html#combining-metadata-and-full-text-queries][advanced searching tutorial]], it would require using ~org-search-view~ with a query with specific regular expression syntax, like this:
#+BEGIN_EXAMPLE
+lisp +{^\*+\s-+TO-READ\s-}
#+END_EXAMPLE
But with =org-ql= or =org-agenda-ng=, you would write:
#+BEGIN_SRC elisp
(org-agenda-ng
(and (regexp "lisp")
(todo "TO-READ")))
#+END_SRC