* [BUG] `org-format-outline-path` returns inproper `org-level-N` face for a heading if its level is not consequent from its parent heading.
@ 2024-10-18 9:35 daisysky--- via General discussions about Org-mode.
2024-10-18 17:33 ` Ihor Radchenko
0 siblings, 1 reply; 4+ messages in thread
From: daisysky--- via General discussions about Org-mode. @ 2024-10-18 9:35 UTC (permalink / raw)
To: Emacs Orgmode
[-- Attachment #1: Type: text/plain, Size: 1518 bytes --]
From: apple@unix.mail-host-address-is-not-set
To: emacs-orgmode@gnu.org
Subject: [BUG] `org-format-outline-path` returns inproper `org-level-N` face
for a heading if its level is not consequent from its parent heading.
[9.6.15 (release_9.6.15 @ /usr/share/emacs/29.4/lisp/org/)]
Date: Fri, 18 Oct 2024 17:28:33 +0800
Message-ID: <87ldylahfi.fsf@unix.mail-host-address-is-not-set>
--text follows this line--
Remember to cover the basics, that is, what you expected to happen and
what in fact did happen. You don't know how to make a good report? See
https://orgmode.org/manual/Feedback.html#Feedback
Your bug report will be posted to the Org mailing list.
------------------------------------------------------------------------
For example, in an org-mode buffer
```
* Heading level 1
*** Heading level 3 ; where the point is at
```
Run `(org-format-outline-path (org-get-outline-path t nil))` in
`eval-expression`.
The output is `#("Heading level 1/Heading level 3" 0 15 (face org-level-1)
16 31 (face org-level-2))`.
Which doesn't work as expected, it should add face of `org-level-3` instead of
`org-level-2`.
Reproduced the same result by launching Emacs with `emacs -q`.
------------------------------------------------------------------------
Emacs : GNU Emacs 29.4 (build 2, x86_64-unknown-linux-gnu, GTK+ Version 3.24.43, cairo version 1.18.0)
of 2024-10-13
Package: Org mode version 9.6.15 (release_9.6.15 @ /usr/share/emacs/29.4/lisp/org/)
[-- Attachment #2: Type: text/html, Size: 3026 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [BUG] `org-format-outline-path` returns inproper `org-level-N` face for a heading if its level is not consequent from its parent heading.
2024-10-18 9:35 [BUG] `org-format-outline-path` returns inproper `org-level-N` face for a heading if its level is not consequent from its parent heading daisysky--- via General discussions about Org-mode.
@ 2024-10-18 17:33 ` Ihor Radchenko
2024-10-18 17:42 ` Ihor Radchenko
0 siblings, 1 reply; 4+ messages in thread
From: Ihor Radchenko @ 2024-10-18 17:33 UTC (permalink / raw)
To: daisysky; +Cc: Emacs Orgmode
daisysky--- via "General discussions about Org-mode."
<emacs-orgmode@gnu.org> writes:
> For example, in an org-mode buffer
> ```
> * Heading level 1
> *** Heading level 3 ; where the point is at
>
> ```
>
> Run `(org-format-outline-path (org-get-outline-path t nil))` in
> `eval-expression`.
>
> The output is `#("Heading level 1/Heading level 3" 0 15 (face org-level-1)
> 16 31 (face org-level-2))`.
>
> Which doesn't work as expected, it should add face of `org-level-3` instead of
> `org-level-2`.
I can see why it is unexpected, but it is not a bug.
You are calling `org-format-outline-path' on the output of
`org-get-outline-path'. And `org-get-outline-path', does not actually
return the real headline depth. What is does return is
... a list of ancestors for current headline, as a list of strings
In other words, if some ancestors skip certain outline levels, this fact
is not recorded by `org-get-outline-path'.
If you want to apply correct faces according the actual headline depth,
you will need to use a different function, similar to
`org-get-outline-path', that will put "" in place of "missing" outline
levels. You will also need to filter out //. Or you may implement a
custom version of `org-format-outline-path' as well.
TL;DR: Org mode APIs do not provide what you are trying to achieve.
Not a bug.
Canceled.
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [BUG] `org-format-outline-path` returns inproper `org-level-N` face for a heading if its level is not consequent from its parent heading.
2024-10-18 17:33 ` Ihor Radchenko
@ 2024-10-18 17:42 ` Ihor Radchenko
[not found] ` <O9Xr56X--B-9@tuta.io>
0 siblings, 1 reply; 4+ messages in thread
From: Ihor Radchenko @ 2024-10-18 17:42 UTC (permalink / raw)
To: daisysky; +Cc: Emacs Orgmode
Ihor Radchenko <yantar92@posteo.net> writes:
>> Which doesn't work as expected, it should add face of `org-level-3` instead of
>> `org-level-2`.
>
> I can see why it is unexpected, but it is not a bug.
> ...
Just to make sure, did the problem you are reporting surface when you
are calling `org-format-outline-path' from your own Elisp? Or did it
happen with some other user level Org mode command? If the latter, it
might be a bug in Org mode that we want to fix. But then I need to know
the details.
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-10-19 7:32 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-18 9:35 [BUG] `org-format-outline-path` returns inproper `org-level-N` face for a heading if its level is not consequent from its parent heading daisysky--- via General discussions about Org-mode.
2024-10-18 17:33 ` Ihor Radchenko
2024-10-18 17:42 ` Ihor Radchenko
[not found] ` <O9Xr56X--B-9@tuta.io>
2024-10-19 7:33 ` Ihor Radchenko
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.