From df5f6696ecf1ffad46a08942d22b1120b6d47ac3 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Wed, 10 Jul 2024 01:43:47 -0400 Subject: [PATCH] tweak(markdown): fontify code blocks natively Enable `markdown-fontify-code-blocks-natively`, which was disabled in f5570db due to performance issues, which I try to fix by suppressing mode hooks on `markdown-fontify-code-block-natively`. Amend: f5570db4c2a2 Close: #7930 Co-authored-by: real-or-random --- modules/lang/markdown/config.el | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/modules/lang/markdown/config.el b/modules/lang/markdown/config.el index 2119c420d..63d5bd0f0 100644 --- a/modules/lang/markdown/config.el +++ b/modules/lang/markdown/config.el @@ -23,6 +23,7 @@ capture, the end position, and the output buffer.") markdown-gfm-additional-languages '("sh") markdown-make-gfm-checkboxes-buttons t markdown-fontify-whole-heading-line t + markdown-fontify-code-blocks-natively t ;; `+markdown-compile' offers support for many transpilers (see ;; `+markdown-compile-functions'), which it tries until one succeeds. @@ -73,6 +74,13 @@ capture, the end position, and the output buffer.") :override #'markdown-match-generic-metadata (ignore (goto-char (point-max)))) + ;; HACK: markdown-mode calls a major mode without inhibiting its hooks, which + ;; could contain expensive functionality. I suppress it to speed up their + ;; fontification. + (defadvice! +markdown-optimize-src-buffer-modes-a (fn &rest args) + :around #'markdown-fontify-code-block-natively + (delay-mode-hooks (apply fn args))) + (map! :map markdown-mode-map :localleader "'" #'markdown-edit-code-block