Docs: Update examples

This commit is contained in:
Adam Porter 2019-08-19 13:57:10 -05:00
parent 0cbb03b667
commit 77aa32cfe6

View file

@ -26,22 +26,31 @@
More examples are available in [[examples.org]]. More examples are available in [[examples.org]].
#+BEGIN_SRC elisp #+BEGIN_SRC elisp
;; Return a list of Org entry elements in the file "~/org/main.org" ;; Show entries that have any timestamp within the past week. Group
;; which have the SOMEDAY to-do keyword, are tagged "Emacs", and have ;; by date using `org-super-agenda' with the `:auto-ts' group.
;; priority B or higher. (org-ql-search (org-agenda-files)
(org-ql "~/org/main.org" '(ts :from -7 :to today)
(and (todo "SOMEDAY") :title "Recent Items"
(tags "Emacs") :sort '(date priority todo)
(priority >= "B"))) :groups '((:auto-ts t)))
;;=> ((headline (:raw-value "org-board" :begin 1220270 :end 1220403 ...)) ...)
;; Set the tag "Emacs" on every entry in the inbox file that mentions ;; Show a GTD-style "stuck projects" view: PROJECT tasks that have no
;; "Emacs". `org-ql-select' works like `org-ql' but is a function ;; descendants with the NEXT keyword. If you use a "project" tag
;; rather than a macro. The bare-string query "Emacs" is equivalent ;; instead of the to-do keyword, you could replace (todo "PROJECT")
;; to (regexp "Emacs"). ;; with (tags "project").
(org-ql-select "~/org/inbox.org" (org-ql-search (org-agenda-files)
"Emacs" '(and (todo "PROJECT")
:action '(org-toggle-tag "Emacs" 'on)) (not (descendants (todo "NEXT"))))
:title "Stuck Projects")
;; Integrate `org-ql' into a custom Org Agenda command which inserts
;; an `org-ql' block before the regular agenda:
(setq org-agenda-custom-commands
'(("ces" "Custom: Agenda and Emacs SOMEDAY [#A] items"
((org-ql-block '(and (todo "SOMEDAY")
(tags "Emacs")
(priority "A")))
(agenda)))))
;; Return a list of bills coming due, searching all Org Agenda files, ;; Return a list of bills coming due, searching all Org Agenda files,
;; sorted by deadline. The `auto' argument to `deadline' means to match ;; sorted by deadline. The `auto' argument to `deadline' means to match
@ -66,23 +75,22 @@ More examples are available in [[examples.org]].
(property "composer" "Chopin") (property "composer" "Chopin")
(not (property "key")))) (not (property "key"))))
;; Integrate `org-ql' into a custom Org Agenda command which inserts ;; Set the tag "Emacs" on every entry in the inbox file that mentions
;; an `org-ql' block before the regular agenda: ;; "Emacs". `org-ql-select' works like `org-ql' but is a function
(setq org-agenda-custom-commands ;; rather than a macro. The bare-string query "Emacs" is equivalent
'(("ces" "Custom: Agenda and Emacs SOMEDAY [#A] items" ;; to (regexp "Emacs").
((org-ql-block '(and (todo "SOMEDAY") (org-ql-select "~/org/inbox.org"
(tags "Emacs") "Emacs"
(priority "A"))) :action '(org-toggle-tag "Emacs" 'on))
(agenda)))))
;; Show a GTD-style "stuck projects" view: PROJECT tasks that have no ;; Return a list of Org entry elements in the file "~/org/main.org"
;; descendants with the NEXT keyword. If you use a "project" tag ;; which have the SOMEDAY to-do keyword, are tagged "Emacs", and have
;; instead of the to-do keyword, you could replace (todo "PROJECT") ;; priority B or higher.
;; with (tags "project"). (org-ql "~/org/main.org"
(org-ql-search (org-agenda-files) (and (todo "SOMEDAY")
'(and (todo "PROJECT") (tags "Emacs")
(not (descendants (todo "NEXT")))) (priority >= "B")))
:title "Stuck Projects") ;;=> ((headline (:raw-value "org-board" :begin 1220270 :end 1220403 ...)) ...)
#+END_SRC #+END_SRC
* Installation * Installation