Remove need to quote date comparators
This commit is contained in:
parent
41b1e0e837
commit
2aa3ba008e
2 changed files with 24 additions and 29 deletions
37
README.org
37
README.org
|
|
@ -6,9 +6,9 @@ Here's an example of generating a kind of agenda view for today (note that the g
|
||||||
|
|
||||||
#+BEGIN_SRC elisp
|
#+BEGIN_SRC elisp
|
||||||
(org-agenda-ng "~/src/emacs/org-super-agenda/test/test.org"
|
(org-agenda-ng "~/src/emacs/org-super-agenda/test/test.org"
|
||||||
(and (or (date '= today)
|
(and (or (date = today)
|
||||||
(deadline '<=)
|
(deadline <=)
|
||||||
(scheduled '<= today))
|
(scheduled <= today))
|
||||||
(not (done))))
|
(not (done))))
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
|
|
@ -27,36 +27,19 @@ Here are some other examples:
|
||||||
|
|
||||||
(org-agenda-ng "~/org/main.org"
|
(org-agenda-ng "~/org/main.org"
|
||||||
(or (habit)
|
(or (habit)
|
||||||
(deadline '<=)
|
(deadline <=)
|
||||||
(scheduled '<= today)
|
(scheduled <= today)
|
||||||
(and (todo "DONE" "CANCELLED")
|
(and (todo "DONE" "CANCELLED")
|
||||||
(closed '= today))))
|
(closed = today))))
|
||||||
|
|
||||||
(org-agenda-ng "~/org/main.org"
|
(org-agenda-ng "~/org/main.org"
|
||||||
(or (habit)
|
(or (habit)
|
||||||
(and (or (date '= today)
|
(and (or (date = today)
|
||||||
(deadline '<=)
|
(deadline <=)
|
||||||
(scheduled '<= today))
|
(scheduled <= today))
|
||||||
(not (done)))
|
(not (done)))
|
||||||
(and (todo "DONE" "CANCELLED")
|
(and (todo "DONE" "CANCELLED")
|
||||||
(closed '= today))))
|
(closed = today))))
|
||||||
|
|
||||||
(org-agenda-ng "~/org/main.org"
|
|
||||||
(or (habit)
|
|
||||||
(and (or (date '= today)
|
|
||||||
(deadline '<=)
|
|
||||||
(scheduled '<= today))
|
|
||||||
(not (done)))
|
|
||||||
(and (todo "DONE" "CANCELLED")
|
|
||||||
(closed '= today))))
|
|
||||||
(org-agenda-ng "~/org/main.org"
|
|
||||||
(or (habit)
|
|
||||||
(and (or (date '= today)
|
|
||||||
(deadline '<=)
|
|
||||||
(scheduled '<= today))
|
|
||||||
(not (done)))
|
|
||||||
(and (todo "DONE" "CANCELLED")
|
|
||||||
(closed '= today))))
|
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
** org-ql
|
** org-ql
|
||||||
|
|
|
||||||
|
|
@ -47,12 +47,19 @@
|
||||||
(symbol-function ,target)))
|
(symbol-function ,target)))
|
||||||
,@body))
|
,@body))
|
||||||
|
|
||||||
|
;; FIXME: DRY these two macros.
|
||||||
|
|
||||||
(cl-defmacro org-agenda-ng (files pred-body)
|
(cl-defmacro org-agenda-ng (files pred-body)
|
||||||
"Display an agenda-like buffer of entries in FILES that match PRED-BODY."
|
"Display an agenda-like buffer of entries in FILES that match PRED-BODY."
|
||||||
(declare (indent defun))
|
(declare (indent defun))
|
||||||
`(org-agenda-ng--agenda ,files
|
`(org-agenda-ng--agenda ,files
|
||||||
(byte-compile (lambda ()
|
(byte-compile (lambda ()
|
||||||
,pred-body))
|
(cl-symbol-macrolet ((= #'=)
|
||||||
|
(< #'<)
|
||||||
|
(> #'>)
|
||||||
|
(<= #'<=)
|
||||||
|
(>= #'>=))
|
||||||
|
,pred-body)))
|
||||||
#'org-agenda-ng--format-element))
|
#'org-agenda-ng--format-element))
|
||||||
|
|
||||||
(cl-defmacro org-ql (files pred-body &key (action-fn (lambda (element) (list element))))
|
(cl-defmacro org-ql (files pred-body &key (action-fn (lambda (element) (list element))))
|
||||||
|
|
@ -63,7 +70,12 @@ of calling `org-element-headline-parser' at each matching entry."
|
||||||
(declare (indent defun))
|
(declare (indent defun))
|
||||||
`(org-ql--query ,files
|
`(org-ql--query ,files
|
||||||
(byte-compile (lambda ()
|
(byte-compile (lambda ()
|
||||||
,pred-body))
|
(cl-symbol-macrolet ((= #'=)
|
||||||
|
(< #'<)
|
||||||
|
(> #'>)
|
||||||
|
(<= #'<=)
|
||||||
|
(>= #'>=))
|
||||||
|
,pred-body)))
|
||||||
#',action-fn))
|
#',action-fn))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue