dots

my dotfiles
git clone https://tilde.team/~marisa/repo/dots.git
Log | Files | Refs

commit e02327b639b433d092ed802fe08309d66a4ccb2a
parent c227b55abdf5b2e03bb6572b994c86cb53e75b07
Author: mokou <mokou@posteo.de>
Date:   Thu, 28 May 2020 15:47:29 +0200

Add missing function for archiving tasks

Diffstat:
Mdot_doom.d/config.el | 21+++++++++++++++++++++
1 file changed, 21 insertions(+), 0 deletions(-)

diff --git a/dot_doom.d/config.el b/dot_doom.d/config.el @@ -417,3 +417,24 @@ nil next-headline))) +(defun cf/skip-non-archivable-tasks () + (save-restriction + (widen) + ;; Consider only tasks with done todo headings as archivable candidates + (let ((next-headline (save-excursion (or (outline-next-heading) (point-max)))) + (subtree-end (save-excursion (org-end-of-subtree t)))) + (if (member (org-get-todo-state) org-todo-keywords-1) + (if (member (org-get-todo-state) org-done-keywords) + (let* ((daynr (string-to-number (format-time-string "%d" (current-time)))) + (a-month-ago (* 60 60 24 (+ daynr 1))) + (last-month (format-time-string "%Y-%m-" (time-subtract (current-time) (seconds-to-time a-month-ago)))) + (this-month (format-time-string "%Y-%m-" (current-time))) + (subtree-is-current (save-excursion + (forward-line 1) + (and (< (point) subtree-end) + (re-search-forward (concat last-month "\\|" this-month) subtree-end t))))) + (if subtree-is-current + subtree-end ; Has a date in this month or last month, skip it + nil)) ; available to archive + (or subtree-end (point-max))) + next-headline))))