Closed yetanotherfossman closed 1 year ago
Ah, thank you for the pull request!
I'm very surprised to hear that this behavior occurs, because ... Well... At least when I wrote this, org-mode errored out when the code called (outline-next-visible-heading 1)
and there wasn't a visible heading (that is the whole reason for the error catch here).
Can you tell me what version of org-mode you are using? It's possible this behavior changed in a more recent version of org-mode.
I'm at 9.6.4, which is fairly new (I compile Emacs from source). And yes, after investigating a little I see that in etc/ORG-NEWS, since version 9.6, there's the following warning:
The new folding backend breaks some of the
outline-*
functions that rely on the details of visibility state implementation inoutline.el
. The old Org folding backend was compatible with theoutline.el
folding, but it is not the case anymore with the new backend. From now on, usingoutline-*
functions is strongly discouraged when working with Org files.
Now outline-next-visible-heading
is hacked to call org-next-visible-heading
, which indeed doesn't error out.
Okay, so I need to update all the code to stop using outline-
and start using org-
instead, this is good to know.
It also means I can afford to rework this code to not use an error for control flow, which is nice, too.
Is that second part something you can provide as part of this pull request? No worries if not.
Done! Also, now a meaningful message is displayed in the echo area, so the user knows when the inbox is empty.
Hmm, the tests are failing. Did you run them locally?
Right, I should have replaced user-error there. Everything should be OK now.
Thank you!
Currently, when calling
org-gtd-process-inbox
with an empty inbox (i.e. one without headings), a PROPERTIES drawer is incorrectly added to the top of the inbox file, becauseorg-gtd-id-get-create
will eventually be called no matter what. This PR fix that by simply checking if there is an org heading before starting to process the item.