emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "M. Pger" <mpger@protonmail.com>
To: emacs-orgmode <emacs-orgmode@gnu.org>
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	[thread overview]
Message-ID: <vusrgVsTjQZBEB8gsorsDZWOk9ogqzLUlHdtnP2ty65-Zw3xTX8u1OqBIpn8oBwOrmP95qhg0BaEmkdmXWTpMqM2sYSnDu67qbmN0lDDNCU=@protonmail.com> (raw)

[-- 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 --]

             reply	other threads:[~2023-07-10 11:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-10 11:36 M. Pger [this message]
2023-07-11  9:30 ` Feature request: adjust ~org-agenda-format-item~ to let the user choose the first level included in breadcrumbs 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='vusrgVsTjQZBEB8gsorsDZWOk9ogqzLUlHdtnP2ty65-Zw3xTX8u1OqBIpn8oBwOrmP95qhg0BaEmkdmXWTpMqM2sYSnDu67qbmN0lDDNCU=@protonmail.com' \
    --to=mpger@protonmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).