Change: (org-ql-view-recent-items) Use keyword args, etc.
A bit more flexible this way. Also adjust the default groups to be less specific to my own config.
This commit is contained in:
parent
bf14afdf4d
commit
077b7000cf
1 changed files with 11 additions and 10 deletions
|
|
@ -285,12 +285,16 @@ TITLE: An optional string displayed in the header."
|
||||||
(interactive (list (completing-read "View: " (mapcar #'car org-ql-views))))
|
(interactive (list (completing-read "View: " (mapcar #'car org-ql-views))))
|
||||||
(call-interactively (alist-get view org-ql-views nil nil #'string=)))
|
(call-interactively (alist-get view org-ql-views nil nil #'string=)))
|
||||||
|
|
||||||
(cl-defun org-ql-view-recent-items (days &optional (type 'ts) (files (org-agenda-files)))
|
(cl-defun org-ql-view-recent-items
|
||||||
|
(&key days type
|
||||||
|
(files (org-agenda-files))
|
||||||
|
(groups '((:auto-parent t)
|
||||||
|
(:auto-todo t))))
|
||||||
"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', or
|
TYPE may be `ts', `ts-active', `ts-inactive', `clocked', or
|
||||||
`closed'."
|
`closed'."
|
||||||
(interactive (list (read-number "Days: ")
|
(interactive (list :days (read-number "Days: ")
|
||||||
(->> '(ts ts-active ts-inactive clocked closed)
|
:type (->> '(ts ts-active ts-inactive clocked closed)
|
||||||
(completing-read "Timestamp type: ")
|
(completing-read "Timestamp type: ")
|
||||||
intern)))
|
intern)))
|
||||||
;; It doesn't make much sense to use other date-based selectors to
|
;; It doesn't make much sense to use other date-based selectors to
|
||||||
|
|
@ -298,17 +302,14 @@ TYPE may be `ts', `ts-active', `ts-inactive', `clocked', or
|
||||||
(-let* ((query (pcase-exhaustive type
|
(-let* ((query (pcase-exhaustive type
|
||||||
((or 'ts 'ts-active 'ts-inactive)
|
((or 'ts 'ts-active 'ts-inactive)
|
||||||
;; These predicates look forward by default, so we must invert the number.
|
;; These predicates look forward by default, so we must invert the number.
|
||||||
`(,type :from ,(* -1 days) :to 0))
|
`(,type :from ,(- days) :to 0))
|
||||||
((or 'clocked 'closed)
|
((or 'clocked 'closed)
|
||||||
`(,type :from ,days :to 0)))))
|
`(,type :from ,days :to 0)))))
|
||||||
(org-ql-search files
|
(org-ql-search files
|
||||||
query
|
query
|
||||||
:title "Recent items"
|
:title "Recent items"
|
||||||
:sort '(date priority todo)
|
:sort '(date priority todo)
|
||||||
:groups '((:todo "DONE")
|
:groups groups)))
|
||||||
(: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