Closed bjosv closed 2 years ago
I don't know if its common or not to have font-lock involved in the indentation-machinery. Maybe the root-cause is the behavior of erlang-mode?
This part was the hint for looking into font-lock: https://github.com/fenollp/erlang-formatter/blob/252cb19f13aa078be852e4dc1ec868a9d9999484/priv/erlang.el#L1607-L1624
Thank you so much!
The Font Lock mode is involved in erlang-mode's indentation rules and is normally enabled by default for all modes. But when emacs is running without a display, as in batch mode, Font Lock mode is never enabled. See https://github.com/emacs-mirror/emacs/blob/f188b0185e7ace193b1c5501c5520578b4216ea0/lisp/font-core.el#L131-L132
By calling
font-lock-fontify-buffer
we will get correct indentation for the parts of the code handled by font-lock, even when running in batch mode. See comments at https://github.com/emacs-mirror/emacs/blob/master/lisp/font-core.el#L116-L117The involvement of font-lock can be seen by disabling the font-lock mode in an erlang buffer and running:
M-x font-lock-mode
andM-x erlang-indent-current-buffer
..to get the few differences.Fixes #45