all repos — nixfiles @ e339f2ad8d0bbaa849777512cf70b78d2bc0c036

System and user configuration, managed by nix and home-manager

emacs: enable auto-formatting of dnscontrol configurations
Alan Pearce alan@alanpearce.eu
Sun, 09 Feb 2025 16:48:20 +0100
commit

e339f2ad8d0bbaa849777512cf70b78d2bc0c036

parent

45425b88cff507d28640b0623f98949c049ae38a

1 files changed, 7 insertions(+), 0 deletions(-)

jump to
M user/emacs/init.eluser/emacs/init.el
@@ -888,6 +888,12 @@ (use-package astro-ts-mode
   :mode (("\\.astro\\'" . astro-ts-mode)))
 
+(define-derived-mode dnscontrol-mode typescript-ts-mode "DNSControl"
+  "Major mode for editing configuration of DNSControl."
+  (if (featurep 'apheleia)
+      (setq-local apheleia-formatter 'dnscontrol)))
+(add-to-list 'auto-mode-alist '("dnsconfig.js\\'" . dnscontrol-mode))
+
 (autoload 'ansi-color-apply-on-region "ansi-color")
 (defun colourise-compilation-buffer ()
   (ansi-color-apply-on-region compilation-filter-start (point-max)))
@@ -1321,6 +1327,7 @@ (setf (alist-get 'shfmt apheleia-formatters)                   '("shfmt"))
             (setq apheleia-formatters
                   (append apheleia-formatters '((nixpkgs-fmt "nixpkgs-fmt")
+                                                (dnscontrol "dnscontrol" "fmt")
                                                 (golines "golines")
                                                 (taplo "taplo" "format" "-")
                                                 (prettier-gotmpl