Preview in plantuml-mode on macOS Emacs
I encountered 2 issues to preview in plantuml-mode on macOS Emacs. I resolved them but please tell me if you have better solution.
TL;DR
- Upgrade your Java runtime to resolve
CoreText
warnings to stdout - Disable
headless
option- For plantuml-mode example
(setq plantuml-default-exec-mode 'jar) (with-eval-after-load 'plantuml (setq plantuml-java-args (delete "-Djava.awt.headless=true" plantuml-java-args)))
Issues
- There are 2 issues I encountered when using preview (
C-c C-c
) in plantuml-mode
Preview corruption
Cause
- It is caused by
CoreText
warnings fromjava
command to stdout- plantuml-mode gets preview images via stdout
- Warnings to stdout corrupts that behaviour
- [JDK-8244621] [macos10.15] Garbled FX printing plus CoreText warnings on Catalina when building with Xcode 11 - Java Bug System
Solution
- It has been resolved later version of Java runtime, so it can be solution to upgrade your Java environment
- If you installed
openjdk
withbrew
, you can usebrew upgrade openjdk
- You have to consider because it may cause seemingly unrelated issue by upgrading your Java environment
- If you installed
headless exception
Information
Workaround
- Disable passing
-headless
option to plantuml- plantuml-mode passes it to plantuml as default, so disable it
- One of examples to disable it, put the codes at TL;DR into your Emacs configuration file
- plantuml-mode passes it to plantuml as default, so disable it
(setq plantuml-default-exec-mode 'jar) (with-eval-after-load 'plantuml (setq plantuml-java-args (delete "-Djava.awt.headless=true" plantuml-java-args)))
- If using via
plantuml
command, add-gui
optionplantuml
command automatically adds-Djava.awt.headless=true
if-gui
is not specified