;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; helper for building agenda file lists (defun load-org-agenda-files-recursively (dir) "Find all directories in DIR." (unless (file-directory-p dir) (error "Not a directory `%s'" dir)) (unless (equal (directory-files dir nil org-agenda-file-regexp t) nil) (add-to-list 'org-agenda-files dir) ) (dolist (file (directory-files dir nil nil t)) (unless (member file '("." "..")) (let ((file (concat dir file "/"))) (when (file-directory-p file) (load-org-agenda-files-recursively file) ) ) ) ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; set org habit status for yesterday and schedule for today. this is to facilitate adding "skipped" log entries for better reporting and tracking of habits ; this assumes youre operating on daily habits ; https://emacs.stackexchange.com/questions/9433/how-to-make-org-prompt-for-a-timestamp-when-changing-state-of-a-todo/63809 ; https://stackoverflow.com/questions/25437069/how-can-i-mark-org-habits-as-done-in-the-past (defun kmn/org-habit-with-date (&optional arg) (interactive "P") (setq my-activation-time (current-time)) (cl-letf* ((org-read-date-prefer-future nil) (org-popup-calendar-for-date-prompt nil) (my-current-time (org-read-date t t nil "when:" nil "-1d" nil)) ((symbol-function 'current-time) #'(lambda () my-current-time)) ((symbol-function 'org-today) #'(lambda () (time-to-days my-current-time))) ((symbol-function 'org-current-effective-time) #'(lambda () my-current-time)) (super-org-entry-put (symbol-function 'org-entry-put)) ((symbol-function 'org-entry-put) #'(lambda (pom property value) (print property) (if (lambda (or (equal property "LAST_REPEAT") (equal property "SCHEDULED"))) (let ((my-value (format-time-string (org-time-stamp-format t t) my-current-time))) (funcall super-org-entry-put pom property my-value)) (funcall super-org-entry-put pom property value) )))) (if (eq major-mode 'org-agenda-mode) (org-agenda-todo arg) (org-todo arg)) ) (if (eq major-mode 'org-agenda-mode) (org-agenda-schedule arg my-activation-time) (org-schedule arg my-activation-time) ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; org-agenda tuning (view stuff only) (setq org-agenda-todo-ignore-scheduled 'all) ;; Remove completed deadline tasks from the agenda view (setq org-agenda-skip-deadline-if-done t) ;; Remove completed scheduled tasks from the agenda view (setq org-agenda-skip-scheduled-if-done t) ;; Remove completed items from search results (setq org-agenda-skip-timestamp-if-done t) ;; dont tend to care about tag inheritance outside of search (setq org-agenda-use-tag-inheritance nil) ;; add new option to update habit for yesterday and reschedule it as active today (add-hook 'org-agenda-mode-hook (lambda () (local-set-key (kbd "y") 'kmn/org-habit-with-date))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Set some org agendas/dashboards (setq org-agenda-sorting-strategy '( (agenda habit-down time-up scheduled-down priority-down category-keep) (todo habit-up time-down scheduled-down deadline-down todo-state-down priority-down alpha-up) (tags priority-down category-keep) (search category-keep) ) ) (setq org-agenda-file-regexp "\\`[^.].*\\.org\\'") (setq org-agenda-files (list "~/org/_index.org" "~/org/_todo.org" "~/org/health/_health.org" "~/org/health/health_houdini.org" "~/org/health/health_mike.org" )) (setq org-agenda-custom-commands '( ("r" "Personal" ( (agenda "" ( (org-agenda-overriding-header "Personal") )) (agenda "" ( (org-agenda-overriding-header "Habits") (org-agenda-files (list "~/org/_habits.org")) (org-agenda-remove-tags t) )) (todo "+WIP-STYLE=\"habit\"" ( (org-agenda-overriding-header "WIP") )) (todo "+READY-STYLE=\"habit\"" ( (org-agenda-overriding-header "Ready") )) (tags-todo "+PRIORITY<\"D\"-STYLE=\"habit\"" ( (org-agenda-overriding-header "To Do") )) (tags-todo "+PRIORITY>=\"D\"-STYLE=\"habit\"-TODO=\"WIP\"-TODO=\"READY\"" ( (org-agenda-overriding-header "Low Priority") )) ) ) ("d" "Destiny" ( (agenda "" ( (org-agenda-start-on-weekday 2) (org-agenda-overriding-header "Destiny") (org-agenda-files (list "~/org/games/games_destiny.org")) )) (todo "WIP" ( (org-agenda-overriding-header "WIP") (org-agenda-files (list "~/org/games/games_destiny.org")) )) (todo "READY" ( (org-agenda-overriding-header "Ready") (org-agenda-files (list "~/org/games/games_destiny.org")) )) (tags-todo "+resonance_needed>0-STYLE=\"habit\"-WIP-READY" ( (org-agenda-overriding-header "Weapon Shaping") (org-agenda-files (list "~/org/games/games_destiny.org")) )) (tags-todo "+resonance_needed<=0+level_at_all_perks_or_higher<>\"true\"-STYLE=\"habit\"-TODO=\"WIP\"-TODO=\"READY\"" ( (org-agenda-overriding-header "Weapon Leveling") (org-agenda-files (list "~/org/games/games_destiny.org")) )) (tags-todo "+resonance_needed<=0+level_at_all_perks_or_higher=\"true\"+masterworked<>\"true\"-STYLE=\"habit\"-TODO=\"WIP\"-TODO=\"READY\"" ( (org-agenda-overriding-header "Weapon Upgrades") (org-agenda-files (list "~/org/games/games_destiny.org")) )) ) ) ("o" . "Photography") ) )