David Lukeš writes: >> Could you please provide an example? > >> Certainly more details is necessary, even export format (backend) is not >> specified. > > Sorry for that! I somehow thought that the issue would sound familiar > to more seasoned Org users, and someone would come back with either > "yeah, you need to do X" or "yeah, that's a known limitation". > > The export backend is HTML. In case anyone wants to try reproducing > this, I made a minimal working example here: > https://github.com/dlukes/org-html-a-sync-export-syntax-highlighting Thanks for the easy reproducer! I played around with the export there, and I think I have found the cause. As expected, the problem originates from batch mode of Emacs operation. ox-html relies upon htmlize-region -> htmlize-buffer-1 -> htmlize-make-face-map -> htmlize-face-to-fstruct -> htmlize-face-to-fstruct-1. In synchronous export `htmlize-face-to-fstruct-1' returns: font-lock-comment-face -> #s(htmlize-fstruct "#b22222" nil nil nil nil nil nil nil "org-comment") font-lock-comment-delimiter-face -> #s(htmlize-fstruct "#b22222" nil nil nil nil nil nil nil "org-comment-delimiter") font-lock-doc-face -> #s(htmlize-fstruct "#8b2252" nil nil nil nil nil nil nil "org-doc") font-lock-keyword-face -> #s(htmlize-fstruct "#a020f0" nil nil nil nil nil nil nil "org-keyword") font-lock-function-name-face -> #s(htmlize-fstruct "#0000ff" nil nil nil nil nil nil nil "org-function-name") In asynchronous export: default -> #s(htmlize-fstruct "#000000" "#ffffff" 1 nil nil nil nil nil "org-default") font-lock-comment-face -> #s(htmlize-fstruct nil nil nil t t nil nil nil "org-comment") font-lock-comment-delimiter-face -> #s(htmlize-fstruct nil nil nil t t nil nil nil "org-comment-delimiter") font-lock-doc-face -> #s(htmlize-fstruct nil nil nil nil t nil nil nil "org-doc") font-lock-keyword-face -> #s(htmlize-fstruct nil nil nil t nil nil nil nil "org-keyword") font-lock-function-name-face -> #s(htmlize-fstruct nil nil nil t nil nil nil nil "org-function-name") ----------------------------- What can we do on the Org side to fix the issue? One way could be avoiding batch execution altogether, like in the attached patch. However, it will break our process sentinel watching for the export results. Moreover, I am not sure how it will work when export is done from terminal Emacs. Also, I know no way to _not_ create an extra Emacs frame during such export - I imagine that a new frame (even minimized) might be annoying for the users. Maybe we should request Emacs to add --graphical-batch mode feature that will preserve graphical features while not interfering with the WM?