Michael Mauger <michael.mau...@protonmail.com> writes:

> This bug has been difficult to reproduce but several people have
> encountered it, or symptoms of it. Most recently, there has been this
> thread on Reddit:
> https://www.reddit.com/r/emacs/comments/1drxsz6/tangled_0_code_blocks_from_filename_problem/
>
> Unfortunately, replicating on emacs -Q has proven impossible since -Q
> disables some of the implicated features. My Emacs config is contained 
> in Org Babel files that are invoked with `org-babel-tangle-file' and have
> demonstrated the error multiple times.

Thanks for reporting!

> After some poking around I started getting failure when I tried to
> reopen an Org file or ran `normal-mode' on it. Shutting down emacs and
> restarting cleared the issue. When the issue arose when reopening the
> file within a session, the backtrace was pointing to `plistp' failing in
> `org-persist-read'. When I looked at the persist index there were
> entries like:
>
>      (:container
>       ((elisp org-element--headline-cache) (elisp org-element--cache)
>        (version "2.3"))
>       :persist-file "49/605653-361a-49a4-a000-47db8d522096" :associated
>       (:hash "aa1176747642fdac45aaf96095a88367" :file
>        "/home/michael/Projects/my-config/emacs/my-org.org" :inode
>        2554490)
>       :expiry 30 :last-access 1719791738.4428508 :last-access-hr
>       "2024-06-30T19:55:38-0400" ...)
>
> (Note: the "..." in the last entry; sometimes it showed up as "\...".)

This is curious. May it be that you have non-default value of
`pp-default-function'?

> The failure during tangling occurred with `org-get-heading' expecting
> `stringp' but getting `nil'. That seemed to be tracked down to
> `org-complex-heading-regexp' not being set yet. If an error had aborted
> out of the `org-persist-read' it appears we could have half of org-mode
> up but not everything properly initialized.

Sounds right.

> Looking at the code in `org-persist.el' in
> `org-persist--write-elisp-file (file data &optional no-circular pp)'
> around line 486 it handles calling `pp' or `prin1'. The code for `pp'
> uses `pp-use-max-width' (as part of a bug fix #58687) which has since
> been superseded in Emacs 30.

Yes, it should be fixed. I did not know that they quickly obsoleted that
variable.

> It looks like the `org-persist-write' code ought to be updated and the
> `org-persist-read' code made more robust so that it does not just shut
> down processing of Org files entirely. That is if the entry is not a
> plist, act as though no entry exists and proceed as if it were a new
> org file. 

Yes. The case when the contents of index file is a valid Elisp data, but
not the data we expect is currently not covered. It should be.

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