From e10ea654acef10c68fdfa99d67501fa77803761a Mon Sep 17 00:00:00 2001 From: Sameer Rahmani Date: Sun, 9 Jun 2024 21:19:39 +0100 Subject: [PATCH] Add support for cabal-fmt to haskell mode --- nix/modules/haskell/default.nix | 1 + nix/modules/haskell/lisp/fg42/haskell-support.el | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/nix/modules/haskell/default.nix b/nix/modules/haskell/default.nix index 2e4713a..d62bdb9 100644 --- a/nix/modules/haskell/default.nix +++ b/nix/modules/haskell/default.nix @@ -48,6 +48,7 @@ in fg42.paths = (with pkgs;[ haskell-language-server + haskellPackages.cabal-fmt ghc ]); diff --git a/nix/modules/haskell/lisp/fg42/haskell-support.el b/nix/modules/haskell/lisp/fg42/haskell-support.el index ec93013..654c04f 100644 --- a/nix/modules/haskell/lisp/fg42/haskell-support.el +++ b/nix/modules/haskell/lisp/fg42/haskell-support.el @@ -78,7 +78,8 @@ (haskell-mode . turn-on-haskell-doc-mode) (haskell-mode . haskell-indentation-mode) (haskell-mode . haskell-setup-outline-mode) - + (haskell-mode . (lambda () + (require 'haskell-commands))) :bind (:map haskell-mode-map ("M-n" . haskell-goto-next-error) @@ -86,9 +87,18 @@ ("C-c c" . haskell-compile))) +(cl-defmethod fg42/format-buffer-for ((mode (eql haskell-cabal-mode))) + "Use `cabal-fmt' to format the buffer whenever `haskell-cabal-mode' MODE is active." + (message "hehehehehehe") + (haskell-mode-buffer-apply-command "cabal-fmt")) + + (use! haskell-cabal-mode "Cabal integration." - :mode ("\\.cabal\\'")) + :mode ("\\.cabal\\'") + :hook (haskell-cabal-mode . (lambda () + (require 'haskell-commands)))) + (provide 'fg42/haskell-support)