Change: (org-ql-view-recent-items) Disallow some selectors
This commit is contained in:
parent
f8f18716ae
commit
c2b8776eca
1 changed files with 19 additions and 11 deletions
|
|
@ -267,20 +267,28 @@ TITLE: An optional string displayed in the header."
|
||||||
|
|
||||||
(cl-defun org-ql-view-recent-items (days &optional (type 'ts) (files (org-agenda-files)))
|
(cl-defun org-ql-view-recent-items (days &optional (type 'ts) (files (org-agenda-files)))
|
||||||
"Show items in FILES from last DAYS days with timestamps of TYPE.
|
"Show items in FILES from last DAYS days with timestamps of TYPE.
|
||||||
TYPE may be `ts', `ts-active', `ts-inactive', `clocked',
|
TYPE may be `ts', `ts-active', `ts-inactive', `clocked', or
|
||||||
`closed', `deadline', `planning', or `scheduled'."
|
`closed'."
|
||||||
(interactive (list (read-number "Days: ")
|
(interactive (list (read-number "Days: ")
|
||||||
(->> '(ts ts-active ts-inactive clocked closed deadline planning scheduled)
|
(->> '(ts ts-active ts-inactive clocked closed)
|
||||||
(completing-read "Timestamp type: ")
|
(completing-read "Timestamp type: ")
|
||||||
intern)))
|
intern)))
|
||||||
(org-ql-search files
|
;; It doesn't make much sense to use other date-based selectors to
|
||||||
`(,type ,days)
|
;; look into the past, so to prevent confusion, we won't allow them.
|
||||||
:title "Recent items"
|
(-let* ((query (pcase-exhaustive type
|
||||||
:sort '(date priority todo)
|
((or 'ts 'ts-active 'ts-inactive)
|
||||||
:groups '((:todo "DONE")
|
;; These predicates look forward by default, so we must invert the number.
|
||||||
(:name "Log" :category "log" :tag "log")
|
`(,type :from ,(* -1 days) :to 0))
|
||||||
(:auto-parent t)
|
((or 'clocked 'closed)
|
||||||
(:auto-todo t))))
|
`(,type :from ,days :to 0)))))
|
||||||
|
(org-ql-search files
|
||||||
|
query
|
||||||
|
:title "Recent items"
|
||||||
|
:sort '(date priority todo)
|
||||||
|
:groups '((:todo "DONE")
|
||||||
|
(:name "Log" :category "log" :tag "log")
|
||||||
|
(:auto-parent t)
|
||||||
|
(:auto-todo t)))))
|
||||||
|
|
||||||
;;;; Functions
|
;;;; Functions
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue