diff options
author | fpi | 2020-12-20 13:30:04 +0100 |
---|---|---|
committer | fpi | 2022-03-17 14:44:37 +0100 |
commit | 217867b5efe967704ffdeccfa104a30db82ab39d (patch) | |
tree | 938c50fc095eb60cc605ac844873a8a4ceac3462 | |
parent | Set clock checking to tolerate no gap at all (diff) |
Add agenda breadcrumbs listing parent projects
Diffstat (limited to '')
-rw-r--r-- | emacs-init.org | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/emacs-init.org b/emacs-init.org index bd9940b..a012cd8 100644 --- a/emacs-init.org +++ b/emacs-init.org @@ -3687,11 +3687,42 @@ Simple day agenda with =INPROGRESS= tasks (org-agenda-sorting-strategy '(priority-down category-keep user-defined-down)) (org-agenda-cmp-user-defined #'fpi/org-agenda-compare-hotness) - (org-agenda-prefix-format " %i {%(fpi/org-hotness)} %-12:c") + (org-agenda-prefix-format "%-12:c %-45(fpi/org-breadcrumbs)") ;; (org-agenda-prefix-format " %-3i %-12:c%30b %s") )) #+end_src #+begin_src emacs-lisp :tangle no :noweb-ref org-agenda-config +(defun fpi/org-breadcrumbs () + "Return projects over current entry. + +Similar to %b in `org-agenda-prefix-format'." + (org-with-wide-buffer + (let ((depth (fpi/org-project-depth 10)) + result) + (while (< (length result) depth) + (fpi/org-goto-parent-project 10) + (add-to-list 'result + (org-trim + (org-link-display-format + (replace-regexp-in-string + "\\[[0-9]+%\\]\\|\\[[0-9]+/[0-9]+\\]" "" + (nth 4 (org-heading-components)) ;; get entry title + ))))) + (if result + (reduce + (lambda (a b) (format "%s/%s" a b)) + (mapcar (lambda (s) (format "%.12s" s)) result) + ) + "") + ))) +(defun fpi/org-goto-parent-project (depth) + "Goto first project over current entry." + (when (fpi/parent-is-not-done-project-p) + (org-up-heading-safe)) + (while (and (> depth 0) + (not (fpi/is-not-done-project-p)) + (org-up-heading-safe)) + )) (defun fpi/org-agenda-compare-hotness (a b) "Compare level of hot headlines over entries A and B." (let ((ha (fpi/org-agenda-hotness a)) |