From a6a50d7c228649213b5e18920a9e6c6d4bf37241 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Tue, 2 Sep 2025 21:53:52 -0400 Subject: [PATCH] Add d2 to emacs. --- .../roles/emacs/files/emacs/elisp/lang-d2.el | 16 ++++++++++++++++ .../roles/emacs/files/emacs/init.el | 2 ++ 2 files changed, 18 insertions(+) create mode 100644 nix/configuration/roles/emacs/files/emacs/elisp/lang-d2.el diff --git a/nix/configuration/roles/emacs/files/emacs/elisp/lang-d2.el b/nix/configuration/roles/emacs/files/emacs/elisp/lang-d2.el new file mode 100644 index 0000000..a4b2696 --- /dev/null +++ b/nix/configuration/roles/emacs/files/emacs/elisp/lang-d2.el @@ -0,0 +1,16 @@ +(defun d2-format-buffer () + "Run prettier." + (interactive) + (run-command-on-buffer "d2" "fmt" "-") + ) + +(use-package d2-mode + :commands (d2-mode) + :hook ( + (d2-mode . (lambda () + ;; (add-hook 'before-save-hook 'd2-format-buffer nil 'local) + )) + ) + ) + +(provide 'lang-d2) diff --git a/nix/configuration/roles/emacs/files/emacs/init.el b/nix/configuration/roles/emacs/files/emacs/init.el index ad9ff8b..9a1bc6c 100644 --- a/nix/configuration/roles/emacs/files/emacs/init.el +++ b/nix/configuration/roles/emacs/files/emacs/init.el @@ -40,4 +40,6 @@ (require 'lang-cmake) +(require 'lang-d2) + (load-directory autoload-directory)