0

EDIT: By removing the auto-indent, it looks like this:

* Work
** Project A
SCHEDULED: <2021-10-04 Mon 10:00-12:00 +1w>
* Training
** Sport A
*** Exercise X
SCHEDULED: <2021-10-04 Mon 08:00-09:00 +1w>

and this:

agenda: 08:00-09:00 Scheduled: Exercise X
agenda: 10:00-12:00 Project A

BUT still not like this (whether it includes Scheduled or not):

agenda: 08:00-09:00 Training: Sport A: Exercise X
agenda: 10:00-12:00 Work: Project A

I have something like this in my org file:

* Work
  ** Project A
  SCHEDULED: <2021-10-04 Mon 10:00-12:00 +1w>
* Training
  ** Sport A
  *** Exercise X
  SCHEDULED: <2021-10-04 Mon 08:00-09:00 +1w>

Now what I see in my agenda is something similar to this:

agenda: 08:00-09:00 Training
agenda: 10:00-12:00 Work

BUT what I would like to see is this:

agenda: 08:00-09:00 Training: Sport A: Exercise X
agenda: 10:00-12:00 Work: Project A

Or at least this:

agenda: 08:00-09:00 Exercise X
agenda: 10:00-12:00 Project A

My question: How can I achieve this?

1

In order for the asterisks to be interpreted as headline indicators, there should not be any leading space; otherwise, they are interpreted as just text. Try this:

* Work
** Project A
  SCHEDULED: <2021-10-04 Mon 10:00-12:00 +1w>
* Training
** Sport A
*** Exercise X
  SCHEDULED: <2021-10-04 Mon 08:00-09:00 +1w>

This produces the second, simpler form you specified in your question. To produce the expanded form, you need to add breadcrumbs to org-agenda-prefix-format. That is a somewhat complicated variable (see its doc string with C-h v org-agenda-prefix-format) but the following works:

(setf 
   (car org-agenda-prefix-format) 
   '(agenda . " %i %-12:c%?-12t% s %b "))

The key is the %b added at the end: that produces the breadcrumbs (i.e. the sequence of headlines higher up that lead to this particular headline).

However, you need to add that to your init file AFTER Org mode is loaded, otherwise the variable will not have been defined yet. Probably the easiest thing to do is to add the following two lines to your init file (somewhere towards the end of it):

(require 'org-agenda)
(setf 
   (car org-agenda-prefix-format) 
   '(agenda . " %i %-12:c%?-12t% s %b "))
3
  • I have just realized that. But it's still not quite what I have in mind.
    – topkek
    Sep 24 at 13:52
  • I assume because it produces the simple form, not the more complete form you asked for? I have edited the answer to produce that too.
    – NickD
    Sep 24 at 14:07
  • You are right, this one is QUITE complicated. It works, thanks!
    – topkek
    Sep 24 at 14:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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