branch: elpa/haskell-tng-mode commit d1e599a9c221eb9c77eee15d248b976984a52cd3 Author: Tseen She <ts33n....@gmail.com> Commit: Tseen She <ts33n....@gmail.com>
switch formatting backend based on project config --- README.md | 9 +++++---- haskell-tng-extra-stack.el | 2 +- haskell-tng-extra.el | 8 ++++++++ 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index b355e60..ad03848 100644 --- a/README.md +++ b/README.md @@ -75,16 +75,17 @@ To find out which module a symbol belongs to, use `M-x haskell-tng-fqn-at-point` To automatically import a symbol at point, use `M-x haskell-tng-import-symbol-at-point`. -## Contrib +## Extras Integrations are provided for common libraries and external applications. The installation instructions above enable all the integrations. Remove the `require` lines for packages that are unwanted. -Third party Haskell tools must be installed separately (e.g. via `cabal v2-install`) for: +Third party Haskell tools must be installed separately (e.g. via `cabal v2-install`): -- `C-c C` invoke [`stack2cabal`](https://hackage.haskell.org/package/stack2cabal) -- `C-c C-r f` invoke [`stylish-haskell`](https://hackage.haskell.org/package/stylish-haskell) +- [`stack2cabal`](https://hackage.haskell.org/package/stack2cabal) +- [`stylish-haskell`](https://hackage.haskell.org/package/stylish-haskell) +- [`ormolu`](https://github.com/tweag/ormolu) - `C-c p R` invoke [`fast-tags`](https://hackage.haskell.org/package/fast-tags) via [`projectile`](https://github.com/bbatsov/projectile) ## Contributing diff --git a/haskell-tng-extra-stack.el b/haskell-tng-extra-stack.el index 40562fa..1d67fd0 100644 --- a/haskell-tng-extra-stack.el +++ b/haskell-tng-extra-stack.el @@ -10,7 +10,7 @@ ;;; Code: ;; TODO document -;; FIXME implement +;; TODO implement (provide 'haskell-tng-extra-stack) ;;; haskell-tng-extra-stack.el ends here diff --git a/haskell-tng-extra.el b/haskell-tng-extra.el index 5f7d5ac..a031996 100644 --- a/haskell-tng-extra.el +++ b/haskell-tng-extra.el @@ -54,6 +54,14 @@ When in a comment and called with a prefix, the comment will be completed." (insert rem))))) ;;;###autoload +(defun haskell-tng-format () + "Uses stylish-haskell if there is a config file, falling back to ormolu." + (interactive) + (if (locate-dominating-file default-directory ".stylish-haskell.yaml") + (haskell-tng-stylish-haskell) + (haskell-tng-ormolu))) + +;;;###autoload (defun haskell-tng-stylish-haskell () "Apply `stylish-haskell' rules." ;; TODO use https://github.com/purcell/reformatter.el