How can I debug byte compile process by `doom sync` and `doom build`

What happened?

I make a org-fold-core-style patch for org-brain.(Fix org-link issue in entry section by hwiorn · Pull Request #387 · Kungsgeten/org-brain · GitHub) org-fold-core-style has the same issue on org-roam. I saw it sometimes works and sometimes not. However it always works on Emacs 30.0.50.

It works too without the elc file. And I found that doom sync optimized let-binding after byte-compile.

(let ((org-fold-core-style 'overlays))
  (setq-local org-pretty-entities t)
  (font-lock-ensure (point-min) (point-max))
    (setq-local org-pretty-entities t)
    (font-lock-ensure (point-min) (point-max))
  • Emacs 28.2 + doom sync: local-variable let binding optimized. It doesn’t work.
  • Emacs 28.2 + M-x byte-compile-file: local-variable let binding doesn’t be optimized. It works.
  • Emacs 30.0 + doom sync: local-variable let binding doesn’t be optimized. It works.

I check the org-fold-core-style keyword exists in elc file. After change let to setq-local, it doesn’t optimze the keyword anymore.

What did you expect to happen?

doom sync cannot make different byte compile result on Emacs 28.2

Steps to reproduce

I want to see and manipulate byte-compile process which used in doom build.

  1. Use (package! org-brain)
  2. Remove ~/.emacs.d/.local/straight/build-*/org-brain/ directory
  3. doom sync
  4. Check the org-fold-core-style keyword in ~/.emacs.d/.local/straight/build-*/org-brain/org-brain.elc

System information

Loading data dump...