420actionun...@gmail.com writes:

> I set a breakpoint at the beginning of function
> ORG-FOLD-CORE-GET-FOLDING-SPEC-FROM-ALIAS. It runs quite a few times
> successfully. Every time the input argument SPEC-OR-ALIAS has one of
> these values: 'ORG-FOLD-VISIBLE or 'ORG-FOLD-HIDDEN. But at some point
> the function runs with a value of 'DRAWER, and that's when it returns
> NIL and the error is thrown higher up in ORG-FOLD-CORE-REGION when it
> explicitly tests for a NIL result.
> ORG-FOLD-CORE--SPEC-SYMBOLS has the value:
> But when a drawer wants to be added we call ORG-FOLD-REGION like this:

This implies that the buffer where `org-fold-region' is called is not in
Org mode or did not have Org property initialized.
`org-insert-property-drawer' expects the buffer to be in Org mode.

> I'm still unclear on how ORG-FOLD-CORE--SPEC-SYMBOLS gets set with
> this alist. Is there is an opportunity for callers to customize it?
> What would be appropriate values to add for 'DRAWER and 'OUTLINE?

The answer to this question is described in the top commentary of
org-fold-core.el. Also, see `org-fold-initialize'.

However, the problem is not just with folding. As I said,
`org-insert-property-drawer' expect the major mode to be Org mode. Your
backtrace implies that either the buffer is not in Org mode or something
strange was done when initializing Org. Either way, random failures may
happen - Org mode APIS, unless explicitly stated, expect major mode to
be Org.

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>

Reply via email to