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


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)
                             (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 

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)

(advice-add #'org-agenda-format-item :filter-args

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.