Skip to content

Latest commit

 

History

History
78 lines (64 loc) · 3.85 KB

README.org

File metadata and controls

78 lines (64 loc) · 3.85 KB

ghcid-mode Readme

This is a ghcid minor mode support for emacs. It uses a terminal with compilation-mode.

Features

This minor mode will provide following features when activated:

  • start ghcid automatically once activated
  • detect the project root directory based on open buffer file
  • check project build tools and construct the ghcid command accordingly
  • jump to error position
  • customize the ghcid repl command, test command, setup command or lint command

installation

doom emacs

With doom emacs, add following to packages.el:

(package! ghcid
  :recipe (:host github :repo "hughjfchen/ghcid-mode"))

and following to the config.el:

(use-package! ghcid
  :config (load! ghcid))

use-package

For vallina emacs, recommand use use-package: install it:

(straight-use-package '(ghcid-mode :host github :repo "hughjfchen/ghcid-mode"
                                :files (:defaults "*.el")))

and then config to activate it when haskell-mode is active:

(use-package haskell-mode
    :init
     (add-hook 'haskell-mode-hook #'ghcid-mode))

Configuration

If ghcid-mode not able to start ghcid with correct command, you can config it using a .dir-locals.el file as so:

((haskell-mode . ((ghcid-repl-command-line . ("cabal" "new-repl" "hsprjup:lib:hsprjup" "\\-f" "ghcidlibwithtest"))
         (ghcid-test-command-line . "TestMain.main")
         (ghcid-setup-command-line . ":load test/Spec.hs"))))

Following table lists the customization variables:

nametypemeaningremarks
ghcid-project-rootstringthe project root directoryusually no need to set it, ghcid-mode should detect it automatically
ghcid-targetstringthe ghci repl target, could be a lib, an exe or a testFor multi target you could set
ghcid-repl-command-linea list with stringthe ghcid command line to start the ghcithe whole command to start the ghci
ghcid-test-command-linestringthe ghcid test command
ghcid-setup-command-linestringthe ghcid setup command
ghcid-lint-command-linestringthe ghcid lint command

Jump to error

This mode uses compilation-mode within a terminal, so if there’re some build errors, you can use the flycheck keys(usually ]+q and [+q) to jump to the errors.

Credits

This minor mode is based on the work of the original ghcid plugin for emacs and inspired by the excellent dante project. So Credits go to Following people:

  • Matthew Wraith <wraithm@gmail.com>
  • Yorick Sijsling
  • Vasiliy Yorkin <vasiliy.yorkin@gmail.com>
  • Neil Mitchell <ndmitchell@gmail.com>
  • Jean-Philippe Bernardy