From f80f52ba4f0361e25d3918ca1d9b80755a4ec006 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ellis=20Keny=C5=91?= Date: Tue, 16 Aug 2022 08:19:02 +0100 Subject: [PATCH] feat(format): add :lang data formatter --- modules/lang/data/config.el | 4 +++- modules/lang/data/doctor.el | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 modules/lang/data/doctor.el diff --git a/modules/lang/data/config.el b/modules/lang/data/config.el index 45ec4f6b1..24498563e 100644 --- a/modules/lang/data/config.el +++ b/modules/lang/data/config.el @@ -8,7 +8,9 @@ (setq nxml-slash-auto-complete-flag t nxml-auto-insert-xml-declaration-flag t) (set-company-backend! 'nxml-mode '(company-nxml company-yasnippet)) - (setq-hook! 'nxml-mode-hook tab-width nxml-child-indent)) + (setq-hook! 'nxml-mode-hook tab-width nxml-child-indent) + (when (executable-find "xmllint") + (set-formatter! 'xmllint '("xmllint" "--format" "-") :modes '(nxml-mode)))) ;;;###package csv-mode diff --git a/modules/lang/data/doctor.el b/modules/lang/data/doctor.el new file mode 100644 index 000000000..b18eb5d54 --- /dev/null +++ b/modules/lang/data/doctor.el @@ -0,0 +1,5 @@ +;;; lang/data/doctor.el -*- lexical-binding: t; -*- + +(when (modulep! :editor format) + (unless (executable-find "xmllint") + (warn! "Couldn't find xmllint. Formatting will be disabled.")))