2

In Emacs org-mode, I have a set of TODOs in the following format:

* H1 ** H2 *** H3 **** TODO [#A] File Taxes 

If I activate breadcrumbs in org-agenda-prefix-format (i.e., by doing (setf (alist-get 'agenda org-agenda-prefix-format) " %i %-12:c%?-12t% s%b")), when I look at the agenda-todo view, it shows up as:

H1->H2->H3->TODO [#A] File Taxes 

Is there any way to rearrange the agenda view of the headline and breadcrumbs so that it displays like this?

TODO [#A] H1->H2->H3->File Taxes 

1 Answer 1

0

I managed to come up with my own solution to this problem using an advice function:

(defvar org-agenda-breadcrumbs-level 1 "Highest level subtree to include in Org agenda breadcrumb.") (defun org-agenda-breadcrumbs-string () "Create formatted string with outline of Org subtree at point. The outline goes up to subtree level `org-agenda-breadcrumbs-level` and the subtree headings are separated by `org-agenda-breadcrumbs-separator`." (if (org-is-habit-p) "" (org-format-outline-path (nthcdr (1- org-agenda-breadcrumbs-level) (org-get-outline-path)) (1- (frame-width)) nil org-agenda-breadcrumbs-separator))) (defun org-agenda-insert-breadcrumbs-before-text (args) "In Org agenda, insert outline breadcrumbs just before heading text in ARGS. This is an advice function for use with `org-agenda-format-item` by doing: (advice-add #'org-agenda-format-item :filter-args #'org-agenda-insert-breadcrumbs-before-text) Since ARGS is the list of arguments to be passed to `org-agenda-format-item`, the second list element of ARGS contains the heading text to be modified." (org-with-point-at (org-get-at-bol 'org-marker) (let* ((txt (org-get-heading t t t t)) (index (or (cl-search txt (cadr args)) 0)) (bc (let ((s (org-agenda-breadcrumbs-string))) (if (eq "" s) "" (concat s org-agenda-breadcrumbs-separator))))) (setf (substring (cadr args) index index) bc) args))) (advice-add #'org-agenda-format-item :filter-args #'org-agenda-insert-breadcrumbs-before-text) 
2
  • 1
    I got Warning (org-element): ‘org-element-at-point’ cannot be used in non-Org buffer #<buffer *Org Agenda*> (org-agenda-mode) for emacs 29.4 with org 9.7.11 Commented Feb 6 at 20:57
  • This is due to a change in Org 9.7. Some function in here, such as org-with-point-at or org-get-outline-path is invoking org-element-at-point whenever there is a breadcrumb to insert. I'm not sure how to fix this. Commented Feb 7 at 12:36

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.