emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Feature request: adjust ~org-agenda-format-item~ to let the user choose


From: M. Pger
Subject: Feature request: adjust ~org-agenda-format-item~ to let the user choose the first level included in breadcrumbs
Date: Mon, 10 Jul 2023 11:36:07 +0000

Dear All,

Including "%b" in the org agenda prefix formats (org-agenda-prefix-format​) allows to display entries' outline paths, which is super useful to get project-oriented agenda views/todo-list.  

Consider a project 'Foobar Report'. In the agenda view/todo-list, it would look like the following:
```
PROJECT Foobar Report
Foobar Report->TODO Task1
Foobar Report->Task1->TODO Subtask1.1
Foobar Report->Task1->TODO Subtask1.2
Foobar Report->TODO Task2
Foobar Report->Task2-> TODO Subtask2.1
Foobar Report->Task2-> TODO Subtask2.2
```

In such a setting, having 'Foobar Report' at the beginning of each line is not really useful and can impair readability.  To tell Org to only print breadcrumbs starting at e.g. level 2 (i.e. skipping the 'Foobar Report' part of the breadcrumbs), I followed the first part of https://list.orgmode.org/CAGEgU=hGnXj7TSGV6pvdSeWFWP_iVwe8WRu+uh8Hjh_7NNRKLw@mail.gmail.com/  and modified the following part of org-agenda-format-item​:
```
(when org-prefix-has-breadcrumbs
     (setq breadcrumbs
                     (org-with-point-at (org-get-at-bol 'org-marker)
                        (let ((s (org-format-outline-path (org-get-outline-path)
                                                                                  (1- (frame-width))
                                                                                  nil org-agenda-breadcrumbs-separator)))
                           (if (eq "" s) "" (concat s org-agenda-breadcrumbs-separator))))))
```
by replacing (org-get-outline-path) with
​```
(nthcdr (1- org-agenda-breadcrumbs-start-level)
            (org-get-outline-path))
​```
while setting a custom variable org-agenda-breadcrumbs-start-level​ to 2. It works well.

Would the Org devs/active contributors be willing to implement such modification (maybe a cleaner version, with a better custom variable name?) in the next release of Org?

Best,

MP

PS: Note that I tried to implement the same using advice-add​, but miserably failed and decided to go for a complete redefinition of org-agenda-format-item (more lines, but less pain).
 ​

reply via email to

[Prev in Thread] Current Thread [Next in Thread]