branch: elpa/haskell-tng-mode
commit 499c77f5573abe0f948f2bf929961c127d302def
Author: Tseen She <[email protected]>
Commit: Tseen She <[email protected]>
abbrev-mode support
---
README.md | 2 +-
haskell-tng-contrib-abbrev.el | 31 +++++++++++++++++++++++++++++++
2 files changed, 32 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 222ee98..474bb95 100644
--- a/README.md
+++ b/README.md
@@ -45,6 +45,7 @@ A full installation may look like the following
:config
(require 'haskell-tng-hsinspect)
(require 'haskell-tng-contrib)
+ (require 'haskell-tng-contrib-abbrev)
(require 'haskell-tng-contrib-company)
(require 'haskell-tng-contrib-projectile)
(require 'haskell-tng-contrib-smartparens)
@@ -163,7 +164,6 @@ This is the status of core features:
- and [`hlint`](https://github.com/ndmitchell/hlint)
- and for faster feedback, [`ghcid`](https://github.com/ndmitchell/ghcid)
- [visualise values as
types](https://twitter.com/jyothsnasrin/status/1039530556080283648)
-- are there any sensible `abbrev-mode` defaults?
- [`djinn`](https://hackage.haskell.org/package/djinn) /
[`justdoit`](https://hackage.haskell.org/package/ghc-justdoit) integration
- [`pointfree`](https://hackage.haskell.org/package/pointfree) integration
- is there a solution to thinking "right to left" vs writing "left to right"?
(easy left token movement?)
diff --git a/haskell-tng-contrib-abbrev.el b/haskell-tng-contrib-abbrev.el
new file mode 100644
index 0000000..4807aa1
--- /dev/null
+++ b/haskell-tng-contrib-abbrev.el
@@ -0,0 +1,31 @@
+;;; haskell-tng-contrib-abbrev.el --- abbrev-mode integration -*-
lexical-binding: t -*-
+
+;; Copyright (C) 2019 Tseen She
+;; License: GPL 3 or any later version
+
+;;; Commentary:
+;;
+;; Some useful abbrev-mode expansions.
+;;
+;;; Code:
+
+(require 'abbrev)
+(require 'skeleton)
+(require 'haskell-tng-mode)
+
+(define-skeleton haskell-tng--skeleton-case-of
+ "case...of boilerplate"
+ nil "case " _ " of")
+
+(define-abbrev
+ haskell-tng-mode-abbrev-table
+ "case" "" #'haskell-tng--skeleton-case-of)
+
+(add-hook
+ 'haskell-tng-mode-hook
+ (lambda ()
+ ;; TODO disable the request to save the abbrev table
+ (abbrev-mode 1)))
+
+(provide 'haskell-tng-contrib-abbrev)
+;;; haskell-tng-contrib-abbrev.el ends here