diff --git a/.emacs.d/functions.org b/.emacs.d/functions.org index 43b8bf9..cda4e82 100644 --- a/.emacs.d/functions.org +++ b/.emacs.d/functions.org @@ -67,7 +67,7 @@ These functions are for my org roam daily capture template. (jm/dt-filter-tasks (lambda () (when (member (org-get-todo-state) '("TODO" "WAITING" "IN PROGRESS")) (jm/dt-format-link (or prompt "-")))) - (format-time-string (format "%s<=\"<%%Y-%%m-%%d>\"" type) date)))) + (format (format-time-string "%%s<=\"<%Y-%m-%d>\"" date) type)))) (defun jm/dt-get-due-within (days &optional prompt) (jm/dt-get-within jm/dt-deadline days prompt)) @@ -103,9 +103,7 @@ Taken from the book /12 Week Year/, the weekly scorecard is a way to measure how #+begin_src emacs-lisp (defun jm/checkbox-checked-p (checkbox) - (cond ((eq 'on (org-element-property :checkbox checkbox)) t) - ((eq 'off (org-element-property :checkbox checkbox)) nil) - ((org-element-property :checkbox checkbox) (error "Invalid checkbox status")))) + (eq 'on (org-element-property :checkbox checkbox))) (defun jm/catalog-checkboxes (buffer) (with-current-buffer buffer @@ -132,25 +130,28 @@ Taken from the book /12 Week Year/, the weekly scorecard is a way to measure how (kill-buffer buffer)) dictionary)) -(defun jm/n-day-scorecard (n) - (let ((time (time-convert (or (org-capture-get :default-time) (current-time)) 'integer)) +(defun jm/n-day-scorecard (n &optional start-time) + (let ((time (time-convert + (or start-time + (org-capture-get :default-time) + (current-time)) + 'integer)) (dailies-directory (expand-file-name org-roam-dailies-directory org-roam-directory)) (dict nil)) (dotimes (i n dict) - (message (format-time-string "%Y-%m-%d.org" (- time (* i 86400)))) (setq dict (jm/score-checkboxes (expand-file-name (format-time-string "%Y-%m-%d.org" (- time (* i 86400))) dailies-directory) dict))))) -(defun jm/scorecard (days) +(defun jm/scorecard (days &optional start-time) (interactive) (let* ((separator "|---|---|---|---|\n") (table (concat "| Task | Completed | Total | Percentage |\n" separator)) (checked-sum 0) (total-sum 0)) - (dolist (box (jm/n-day-scorecard days) table) + (dolist (box (jm/n-day-scorecard days start-time) table) (let* ((name (car box)) (checked (cadr box)) (total (cadr (cdr box)))