branch: elpa/haskell-tng-mode commit 4cbf702a023b724753406629794e866c6e53c157 Author: Tseen She <ts33n....@gmail.com> Commit: Tseen She <ts33n....@gmail.com>
move third party deps to -contrib --- Cask | 1 + README.md | 10 ++++------ haskell-tng-contrib.el | 34 ++++++++++++++++++++++++++++++++++ haskell-tng-mode.el | 31 +------------------------------ 4 files changed, 40 insertions(+), 36 deletions(-) diff --git a/Cask b/Cask index 68f409a..02fcf2b 100644 --- a/Cask +++ b/Cask @@ -28,6 +28,7 @@ (depends-on "faceup") (depends-on "ert-runner") (depends-on "undercover") + (depends-on "projectile") (depends-on "smartparens") (depends-on "yasnippet")) diff --git a/README.md b/README.md index cd14894..d46bff4 100644 --- a/README.md +++ b/README.md @@ -39,12 +39,13 @@ Check out the source code repository and add to your load path: ```lisp (add-to-list 'load-path (expand-file-name "~/Projects/haskell-tng.el/")) (require 'haskell-tng-mode) -(require 'haskell-tng-contrib) ;; optional ``` Integrations are provided for common libraries, enable them with ```lisp +(require 'haskell-tng-contrib) + (add-hook 'haskell-tng-mode-hook (lambda () @@ -62,7 +63,7 @@ Integrations are provided for common libraries, enable them with - `C-- C-c c` clean project - `C-c e` jump to error -### Contrib / Third Party +### Contrib - `C-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) @@ -80,10 +81,7 @@ This is the status of core features: - [ ] `imenu` population - Editing: - [x] indentation - - [x] `prettify-symbols` emulating `UnicodeSyntax` - - [x] `smartparens` rules - - [x] `yasnippet` templates - - [x] `stylish-haskell` support + - [x] `prettify-symbols` to emulate `UnicodeSyntax` - Compiling: - [x] `haskell-tng-compile` for `cabal` batch commands - [x] `stack`, `nix`, `shake`, etc support (customise `haskell-tng--compile-*`) diff --git a/haskell-tng-contrib.el b/haskell-tng-contrib.el index 5bc1f2e..681b088 100644 --- a/haskell-tng-contrib.el +++ b/haskell-tng-contrib.el @@ -12,6 +12,13 @@ (require 'subr-x) +(require 'haskell-tng-util) + +;; optional third party dependencies +(require 'projectile nil t) +(require 'smartparens nil t) +(require 'yasnippet nil t) + ;; TODO a generic wrapper around commands that can be downloaded and built using ;; cabal v2-install. @@ -33,5 +40,32 @@ (call-process "stack2cabal"))) (defalias 'stack2cabal 'haskell-tng-stack2cabal) +;;;###autoload +(progn + (when (boundp yas-minor-mode) + (add-to-list + 'yas-snippet-dirs + (expand-file-name + "snippets" + (haskell-tng--util-this-lisp-directory))) + (yas-reload-all nil t)) + + (when (fboundp 'sp-local-pair) + (dolist (pair '(("(" . ")") + ("[" . "]") + ("{" . "}") + ("{-" . "-}") + ("{-#" . "#-}"))) + (sp-local-pair 'haskell-tng-mode (car pair) (cdr pair) + :post-handlers '(("| " "SPC"))))) + + (add-hook + 'haskell-tng-mode + (lambda () + (when (boundp projectile-mode) + (setq-local projectile-tags-command "fast-tags -Re --exclude=dist-newstyle ."))) + + )) + (provide 'haskell-tng-contrib) ;;; haskell-tng-contrib.el ends here diff --git a/haskell-tng-mode.el b/haskell-tng-mode.el index e2ee51f..a0fc5e9 100644 --- a/haskell-tng-mode.el +++ b/haskell-tng-mode.el @@ -33,9 +33,6 @@ Load `prettify-symbols-mode' in `haskell-tng-mode-hook'." :type 'listp :group 'haskell-tng) -;; optional dependency on projectile for TAGS management -(defvar projectile-tags-command) - ;;;###autoload (define-derived-mode haskell-tng-mode prog-mode "Hask" "Major mode for editing Haskell programs." @@ -81,7 +78,6 @@ Load `prettify-symbols-mode' in `haskell-tng-mode-hook'." ;; indentation, so it's best to just make sure it is disabled. (electric-indent-mode 0) - (setq-local projectile-tags-command "fast-tags -Re --exclude=dist-newstyle .") (setq-local smie-blink-matching-inners nil) ;; c.f. `smie-closer-alist' (haskell-tng--smie-setup) @@ -102,32 +98,7 @@ Load `prettify-symbols-mode' in `haskell-tng-mode-hook'." ;;;###autoload (progn (add-to-list 'auto-mode-alist '("\\.hs\\'" . haskell-tng-mode)) - (modify-coding-system-alist 'file "\\.hs\\'" 'utf-8) - - ;; optional dependency - (require 'yasnippet nil t) - (when (boundp yas-minor-mode) - (add-hook - 'yas-minor-mode-hook - (lambda () - (add-to-list - 'yas-snippet-dirs - (expand-file-name - "snippets" - (haskell-tng--util-this-lisp-directory))) - (yas-reload-all nil t)))) - - ;; optional dependency - (require 'smartparens nil t) - (when (fboundp 'sp-local-pair) - (dolist (pair '(("(" . ")") - ("[" . "]") - ("{" . "}") - ("{-" . "-}") - ("{-#" . "#-}"))) - (sp-local-pair 'haskell-tng-mode (car pair) (cdr pair) - :post-handlers '(("| " "SPC"))))) - ) + (modify-coding-system-alist 'file "\\.hs\\'" 'utf-8)) (provide 'haskell-tng-mode) ;;; haskell-tng-mode.el ends here