emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Feature request: adjust ~org-agenda-format-item~ to let the user choose the first level included in breadcrumbs
@ 2023-07-10 11:36 M. Pger
  2023-07-11  9:30 ` Ihor Radchenko
  0 siblings, 1 reply; 6+ messages in thread
From: M. Pger @ 2023-07-10 11:36 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1852 bytes --]

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

​

[-- Attachment #2: Type: text/html, Size: 6972 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-08-11  9:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-10 11:36 Feature request: adjust ~org-agenda-format-item~ to let the user choose the first level included in breadcrumbs M. Pger
2023-07-11  9:30 ` Ihor Radchenko
2023-07-11 19:42   ` M. Pger
2023-07-11 20:14     ` Ihor Radchenko
2023-07-11 20:21       ` M. Pger
2023-08-11  9:22         ` Ihor Radchenko

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).