Subject: Re: bug#68851: 30.0.50; Native comp: Optimization failure for org-element-property-raw: Handler: org-element-property-raw--inliner

From: Ihor Radchenko <[email-masked]>
Date: Wed, 31 Jan 2024 19:47:54 +0000

Stefan Monnier <[email-masked]> writes:

>> ⛔ Warning (comp): Warning: Optimization failure for org-element-property-raw: Handler: org-element-property-raw--inliner
>
> This looks like the warning emitted by `macroexp--compiler-macro` when
> a compiler macro (here, generated by `define-inline`) signals an error.
>
> This said, the warning should include (on the next line) the actual
> error encountered.  Not sure why you don't seem to have that.

I also thought so, but the problem only appears during native
compilation. Normal compilation works just fine.

> In any case the origin might be a bug in your code or in `inline.el`.
>
> Is `org-element--standard-properties-idxs` defined at the time of
> macro-expansion?

Yup:

(eval-and-compile ; make available during inline expansion

  (defconst org-element--standard-properties
    '( :begin :post-affiliated :contents-begin :contents-end :end :post-blank
       :secondary :mode :granularity
       :cached :org-element--cache-sync-key
       :robust-begin :robust-end
       :true-level
       :buffer :deferred
       :structure :parent)
    "Standard properties stored in every syntax node structure.
These properties are stored in an array pre-allocated every time a new
object is created.  Two exceptions are `anonymous' and `plain-text'
node types.")

  (defconst org-element--standard-properties-idxs
    (let (plist)
      (seq-do-indexed
       (lambda (property idx)
         (setq plist (plist-put plist property idx)))
       org-element--standard-properties)
      plist)
    "Property list holding standard indexes for `org-element--standard-properties'."))

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