tvl-depot/users/wpcarro/emacs/.emacs.d/wpc/wpc-haskell.el
William Carroll 9888a88198 chore(wpcarro/emacs): Drop support for lsp-haskell
1. This is spamming my Emacs's *Warnings* buffer on init.
2. I recall this being buggy.
3. I'm not doing active Haskell development at the moment.
4. I'd prefer code-intelligence efforts be put into SourceGraph.

Change-Id: I57ba28ec0b2fa3607cd67261a90d134107166c47
Reviewed-on: https://cl.tvl.fyi/c/depot/+/4610
Reviewed-by: wpcarro <wpcarro@gmail.com>
Autosubmit: wpcarro <wpcarro@gmail.com>
Tested-by: BuildkiteCI
2021-12-25 16:07:54 +00:00

53 lines
1.6 KiB
EmacsLisp

;;; wpc-haskell.el --- My Haskell preferences -*- lexical-binding: t -*-
;; Author: William Carroll <wpcarro@gmail.com>
;; Version: 0.0.1
;; Package-Requires: ((emacs "24"))
;;; Commentary:
;; Hosts my Haskell development preferences
;;; Code:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Dependencies
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(require 'macros)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Configuration
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; font-locking, glyph support, etc
(use-package haskell-mode
:config
(macros-add-hook-before-save 'haskell-mode #'haskell-align-imports))
;; Test toggling
(defun wpc-haskell-module->test ()
"Jump from a module to a test."
(let ((filename (->> buffer-file-name
(s-replace "/src/" "/test/")
(s-replace ".hs" "Test.hs")
find-file)))
(make-directory (f-dirname filename) t)
(find-file filename)))
(defun wpc-haskell-test->module ()
"Jump from a test to a module."
(let ((filename (->> buffer-file-name
(s-replace "/test/" "/src/")
(s-replace "Test.hs" ".hs"))))
(make-directory (f-dirname filename) t)
(find-file filename)))
(defun wpc-haskell-test<->module ()
"Toggle between test and module in Haskell."
(interactive)
(if (s-contains? "/src/" buffer-file-name)
(wpc-haskell-module->test)
(wpc-haskell-test->module)))
(provide 'wpc-haskell)
;;; wpc-haskell.el ends here