Change: (org-ql-agenda) Allow org-super-agenda-groups global value

Also, automatically quote :super-groups in macro expansion, and update
example in readme.
This commit is contained in:
Adam Porter 2018-12-18 06:16:53 -06:00
parent a58273c147
commit 748c3fb619
2 changed files with 21 additions and 15 deletions

View file

@ -44,19 +44,19 @@ Also included is ~org-ql-agenda~, which uses ~org-ql~ queries to select entries
(not (done))) (not (done)))
;; The `org-super-agenda-groups' setting is used automatically when set, or it ;; The `org-super-agenda-groups' setting is used automatically when set, or it
;; may be overriden by specifying it here: ;; may be overriden by specifying it here:
:super-groups '((:name "Bills" :super-groups ((:name "Bills"
:tag "bills") :tag "bills")
(:todo ("SOMEDAY" "TO-READ" "CHECK" "TO-WATCH" "WATCHING") (:todo ("SOMEDAY" "TO-READ" "CHECK" "TO-WATCH" "WATCHING")
:order 7) :order 7)
(:name "Personal" (:name "Personal"
:habit t :habit t
:tag "personal" :tag "personal"
:order 3) :order 3)
(:todo "WAITING" (:todo "WAITING"
:order 6) :order 6)
(:priority "A" :order 1) (:priority "A" :order 1)
(:priority "B" :order 2) (:priority "B" :order 2)
(:priority "C" :order 2))) (:priority "C" :order 2)))
#+END_SRC #+END_SRC
Which presents this buffer: Which presents this buffer:

View file

@ -63,7 +63,11 @@ NARROW, when non-nil, means to respect narrowing in buffers.
When nil, buffers are widened before being searched. When nil, buffers are widened before being searched.
BUFFER, when non-nil, is a buffer or buffer name to display the BUFFER, when non-nil, is a buffer or buffer name to display the
agenda in, rather than the default." agenda in, rather than the default.
SUPER-GROUPS is used to bind variable `org-super-agenda-groups',
which see. If t, the existing value of `org-super-agenda-groups'
is used, rather than binding it locally."
(declare (indent defun) (declare (indent defun)
(advertised-calling-convention (files-or-query &optional query &key sort narrow buffer super-groups) nil)) (advertised-calling-convention (files-or-query &optional query &key sort narrow buffer super-groups) nil))
(cl-macrolet ((set-keyword-args (args) (cl-macrolet ((set-keyword-args (args)
@ -93,6 +97,8 @@ agenda in, rather than the default."
(`(,arg-pred) (`(,arg-pred)
;; Only query ;; Only query
(setq query arg-pred))) (setq query arg-pred)))
(when (eq super-groups t)
(setq super-groups org-super-agenda-groups))
;; Call --agenda ;; Call --agenda
`(org-ql-agenda--agenda ,files `(org-ql-agenda--agenda ,files
;; TODO: Probably better to just use eval on org-ql rather than reimplementing parts of it here. ;; TODO: Probably better to just use eval on org-ql rather than reimplementing parts of it here.
@ -100,7 +106,7 @@ agenda in, rather than the default."
:sort ',sort :sort ',sort
:buffer ,buffer :buffer ,buffer
:narrow ,narrow :narrow ,narrow
:super-groups ,super-groups)))) :super-groups ',super-groups))))
;;;; Functions ;;;; Functions