From 748c3fb619d610a3f71a49c34bedd715e16897f3 Mon Sep 17 00:00:00 2001 From: Adam Porter Date: Tue, 18 Dec 2018 06:16:53 -0600 Subject: [PATCH] Change: (org-ql-agenda) Allow org-super-agenda-groups global value Also, automatically quote :super-groups in macro expansion, and update example in readme. --- README.org | 26 +++++++++++++------------- org-ql-agenda.el | 10 ++++++++-- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/README.org b/README.org index 14edaa1..9d66a5a 100644 --- a/README.org +++ b/README.org @@ -44,19 +44,19 @@ Also included is ~org-ql-agenda~, which uses ~org-ql~ queries to select entries (not (done))) ;; The `org-super-agenda-groups' setting is used automatically when set, or it ;; may be overriden by specifying it here: - :super-groups '((:name "Bills" - :tag "bills") - (:todo ("SOMEDAY" "TO-READ" "CHECK" "TO-WATCH" "WATCHING") - :order 7) - (:name "Personal" - :habit t - :tag "personal" - :order 3) - (:todo "WAITING" - :order 6) - (:priority "A" :order 1) - (:priority "B" :order 2) - (:priority "C" :order 2))) + :super-groups ((:name "Bills" + :tag "bills") + (:todo ("SOMEDAY" "TO-READ" "CHECK" "TO-WATCH" "WATCHING") + :order 7) + (:name "Personal" + :habit t + :tag "personal" + :order 3) + (:todo "WAITING" + :order 6) + (:priority "A" :order 1) + (:priority "B" :order 2) + (:priority "C" :order 2))) #+END_SRC Which presents this buffer: diff --git a/org-ql-agenda.el b/org-ql-agenda.el index f668f1b..08553c3 100644 --- a/org-ql-agenda.el +++ b/org-ql-agenda.el @@ -63,7 +63,11 @@ NARROW, when non-nil, means to respect narrowing in buffers. When nil, buffers are widened before being searched. 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) (advertised-calling-convention (files-or-query &optional query &key sort narrow buffer super-groups) nil)) (cl-macrolet ((set-keyword-args (args) @@ -93,6 +97,8 @@ agenda in, rather than the default." (`(,arg-pred) ;; Only query (setq query arg-pred))) + (when (eq super-groups t) + (setq super-groups org-super-agenda-groups)) ;; Call --agenda `(org-ql-agenda--agenda ,files ;; 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 :buffer ,buffer :narrow ,narrow - :super-groups ,super-groups)))) + :super-groups ',super-groups)))) ;;;; Functions