From b697ad982e11df38c6cc5254874697edd2cf8cdd Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Mon, 3 Sep 2018 03:59:24 +0200 Subject: [PATCH] lang/web: more sensible html-tidy formatter config + No longer inserts html/body tags unless they're detected in the buffer + Respect tab-width and indent-tab-mode + Don't auto-remove empty elements --- modules/lang/web/+html.el | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/modules/lang/web/+html.el b/modules/lang/web/+html.el index 13c8fb9b5..e5d70fa86 100644 --- a/modules/lang/web/+html.el +++ b/modules/lang/web/+html.el @@ -17,6 +17,18 @@ :config (set-docsets! 'web-mode "HTML" "Twig" "WordPress") + ;; tidy is already defined by the format-all package. We redefine it to add + ;; more sensible arguments to the tidy command. + (set-formatter! 'html-tidy + '("tidy" "-q" "-indent" + "--tidy-mark" "no" + "--drop-empty-elements" "no" + "--show-body-only" "auto" + ("--indent-spaces" "%d" tab-width) + ("--indent-with-tabs" "%s" (if indent-tabs-mode "yes" "no")) + ("-xml" (memq major-mode '(nxml-mode xml-mode)))) + :ok-statuses '(0 1)) + (setq web-mode-enable-html-entities-fontification t web-mode-auto-close-style 2)