Skip to content

Commit

Permalink
emacs:vulpea:agenda: include current quarter
Browse files Browse the repository at this point in the history
  • Loading branch information
d12frosted committed Jan 6, 2025
1 parent e66269e commit 5ef49fc
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
3 changes: 2 additions & 1 deletion emacs/lisp/init-vulpea.el
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,8 @@
(,vulpea-agenda-cmd-refile
,vulpea-agenda-cmd-today
,vulpea-agenda-cmd-focus
,vulpea-agenda-cmd-waiting)
,vulpea-agenda-cmd-waiting
,vulpea-agenda-cmd-current-quarter)
((org-agenda-buffer-name vulpea-agenda-main-buffer-name))))))


Expand Down
36 changes: 36 additions & 0 deletions emacs/lisp/lib-vulpea-agenda.el
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,28 @@ Affects the following commands:
(org-agenda-todo-ignore-deadlines
vulpea-agenda-hide-scheduled-and-waiting-next-tasks))))

;;;###autoload
(defconst vulpea-agenda-cmd-current-quarter
(let ((quarter (vulpea-agenda-current-quarter (current-time))))
`(tags-todo
,quarter
((org-agenda-overriding-header
(concat "Tasks for" ,quarter
(if vulpea-agenda-hide-scheduled-and-waiting-next-tasks
""
" (including WAITING and SCHEDULED tasks)")))
(org-agenda-skip-function 'vulpea-agenda-skip-habits)
(org-tags-match-list-sublevels t)
(org-agenda-todo-ignore-scheduled
vulpea-agenda-hide-scheduled-and-waiting-next-tasks)
(org-agenda-todo-ignore-deadlines
vulpea-agenda-hide-scheduled-and-waiting-next-tasks)
(org-agenda-todo-ignore-with-date
vulpea-agenda-hide-scheduled-and-waiting-next-tasks)
(org-agenda-tags-todo-honor-ignore-options t)
(org-agenda-sorting-strategy
'(todo-state-down priority-down effort-up category-keep))))))


;; Utilities to build agenda commands -- skip

Expand Down Expand Up @@ -347,6 +369,20 @@ Refer to `org-agenda-prefix-format' for more information."
result))
(s-repeat (or len 0) " ")))

;;;###autoload
(defun vulpea-agenda-current-quarter (time)
"Return the quarter of the given TIME in the format YYQn (e.g. 25Q1)."
(let* ((decoded (decode-time time))
(year (nth 5 decoded))
(month (nth 4 decoded))
(yy (mod year 100)) ;; last two digits of the year
(quarter (cond
((<= month 3) "Q1")
((<= month 6) "Q2")
((<= month 9) "Q3")
(t "Q4"))))
(format "%02d%s" yy quarter)))



(provide 'lib-vulpea-agenda)
Expand Down

0 comments on commit 5ef49fc

Please sign in to comment.