[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/haskell-tng-mode 9bc086a 187/385: easier install
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/haskell-tng-mode 9bc086a 187/385: easier install |
Date: |
Tue, 5 Oct 2021 23:59:28 -0400 (EDT) |
branch: elpa/haskell-tng-mode
commit 9bc086ac37f580dc0fd19ded676dfd0f28771c16
Author: Tseen She <ts33n.sh3@gmail.com>
Commit: Tseen She <ts33n.sh3@gmail.com>
easier install
---
README.md | 17 +++++++++++++++--
haskell-tng-contrib.el | 2 ++
haskell-tng-mode.el | 25 +++++++++++++++++++++----
haskell-tng-smie.el | 31 ++++++++++++++++++++++++-------
4 files changed, 62 insertions(+), 13 deletions(-)
diff --git a/README.md b/README.md
index 594dfb7..5a5219f 100644
--- a/README.md
+++ b/README.md
@@ -34,14 +34,27 @@ Instead, and following the [anarchical spirit of
Haskell](https://www.microsoft.
## Install
-Check out the source code repository, type `cask build`, and add to your load
path:
+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
```
-There are no plans to distribute any other way: this encourages contributor
engagement.
+## Commands
+
+### Core
+
+- `C-c c` compile, prompt on first use
+ - `C-u C-c c` always prompt
+ - `C-- C-c c` clean project
+ - `C-c e` jump to error
+
+### 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)
## Plan
diff --git a/haskell-tng-contrib.el b/haskell-tng-contrib.el
index 36a7bf3..b90fbe5 100644
--- a/haskell-tng-contrib.el
+++ b/haskell-tng-contrib.el
@@ -15,6 +15,7 @@
;; TODO a generic wrapper around commands that can be downloaded and built
using
;; cabal v2-install.
+;;;###autoload
(defun haskell-tng-contrib:stylish-haskell ()
"Apply `stylish-haskell' rules."
(interactive)
@@ -22,6 +23,7 @@
(call-process "stylish-haskell" nil nil nil "-i" buffer-file-name)
(revert-buffer t t t))
+;;;###autoload
(defun haskell-tng-contrib:stack2cabal ()
"Prepare a stack project for use with cabal."
(interactive)
diff --git a/haskell-tng-mode.el b/haskell-tng-mode.el
index 3acda8a..cc49625 100644
--- a/haskell-tng-mode.el
+++ b/haskell-tng-mode.el
@@ -6,14 +6,15 @@
;; Homepage: https://gitlab.com/tseenshe/haskell-tng-mode
;; Keywords: languages
;; Package-Version: 0.0.1
-;; Package-Requires: ((dash "2.14.1"))
+;; Package-Requires: ((bind-key "2.4") (dash "2.16.0"))
;;; Commentary:
;;
-;; A modern rewrite of `haskell-mode'.
+;; An experimental rewrite of `haskell-mode'.
;;
;;; Code:
+(require 'bind-key)
(require 'dabbrev)
(require 'haskell-tng-syntax)
@@ -84,9 +85,25 @@ Load `prettify-symbols-mode' in `haskell-tng-mode-hook'."
(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))
+ (haskell-tng-smie:setup)
-;; TODO: autoload this when I'm ready to use tng instead of regular
+ (bind-key "<return>" 'haskell-tng-newline haskell-tng-mode-map)
+
+ ;; core compilation loop, supports C-u and C-- prefixes
+ (bind-key "C-c c" 'haskell-tng-compile haskell-tng-mode-map)
+ (bind-key "C-c e" 'next-error haskell-tng-mode-map)
+
+ ;; convenient for commands to work from the compile buffer too
+ (bind-key "C-c c" 'haskell-tng-compile haskell-tng-compilation-mode-map)
+ (bind-key "C-c e" 'next-error haskell-tng-compilation-mode-map)
+
+ ;; external tools
+ (bind-key "C-c C" 'haskell-tng-contrib:stack2cabal haskell-tng-mode-map)
+ (bind-key "C-c C-r f" 'haskell-tng-contrib:stylish-haskell
haskell-tng-mode-map)
+
+ )
+
+;;;###autoload
(progn
(add-to-list 'auto-mode-alist '("\\.hs\\'" . haskell-tng-mode))
(modify-coding-system-alist 'file "\\.hs\\'" 'utf-8))
diff --git a/haskell-tng-smie.el b/haskell-tng-smie.el
index f6a2b70..f83d975 100644
--- a/haskell-tng-smie.el
+++ b/haskell-tng-smie.el
@@ -30,7 +30,27 @@
(require 'haskell-tng-font-lock)
(require 'haskell-tng-lexer)
-;; TODO maybe autodetect? Then delete this user variable
+(defun haskell-tng-newline ()
+ "A `newline-and-indent' with a better user experience for
`haskell-tng-mode'."
+ (interactive)
+ ;; TODO a dynamically bound variable might improve the quality of
+ ;; 'empty-line-token predictions.
+ (let ((rem (when (/= (point) (line-end-position))
+ (buffer-substring-no-properties (point) (line-end-position)))))
+ ;; TODO https://debbugs.gnu.org/cgi/bugreport.cgi?bug=36432
+ (when rem
+ (delete-region (point) (line-end-position)))
+ ;; TODO don't continue line comments if there is code before them
+ ;;
+ ;; TODO in-comment indent should observe | haddock markers
+ (call-interactively #'comment-indent-new-line)
+ (when rem
+ (save-excursion
+ (insert rem)))))
+
+;; TODO autodetection of indent options
+
+;; TODO implement haskell-tng-indent-aligntypes
(defcustom haskell-tng-indent-aligntypes nil
"Whether to align arrows to their parent :: declaration.
@@ -44,7 +64,7 @@ foobar :: Monad m
:type 'booleanp
:group 'haskell-tng)
-;; TODO maybe autodetect? Then delete this user variable
+;; TODO implement haskell-tng-indent-typelead
(defcustom haskell-tng-indent-typelead 3
"Leading spaces in a trailing type signature, relative to type arrows.
For example 3 and 1 are respectively:
@@ -315,16 +335,13 @@ information, to aid in the creation of new rules."
))
(defconst haskell-tng-smie:return
- '(comment-indent-new-line
+ '(haskell-tng-newline
+ comment-indent-new-line
newline-and-indent
newline
haskell-tng-smie:debug-newline)
"Users with custom newlines should add their command.")
-;; TODO newline and indent at the beginning of a line should be the same as
-;; newline and indent at the end of the previous line. Newline in the middle of
-;; a line is trickier.
-
(defvar-local haskell-tng-smie:indentations nil)
(defun haskell-tng-smie:indent-cycle ()
"When invoked more than once, returns an alternative indentation level."
- [nongnu] elpa/haskell-tng-mode eb6b487 357/385: test fqn-at-point and fix a longstanding bug, (continued)
- [nongnu] elpa/haskell-tng-mode eb6b487 357/385: test fqn-at-point and fix a longstanding bug, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 103e758 325/385: expose some more hsinspect-0.0.8 index info, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 374835c 355/385: a test for interactive commands, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode e3c6dc6 336/385: follow re-exports, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 9904e72 366/385: jump-to-definition works inside the project, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 1c68e79 381/385: requires emacs 27, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 55d8e69 385/385: upgrade hsinspect, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 97e4a66 379/385: bump hsinspect, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 3870bf1 367/385: time to remove the cabal v2- prefixes, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 47f1f9f 180/385: lex CONSYM correctly, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 9bc086a 187/385: easier install,
ELPA Syncer <=
- [nongnu] elpa/haskell-tng-mode 4f40db3 218/385: fast-tags is stack compatible by default, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 59640ce 234/385: cleanups thanks to MELPA review, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 35d3830 306/385: cache improvements, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode c0b1b6b 301/385: change the compile-always-ask default, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 907c8fa 153/385: ImplicitParams indentation, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode ca00f1f 183/385: thot, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 611711a 208/385: address melpa review, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 89c5c80 223/385: improve smartparens workaround, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode e270647 228/385: more robust calls to hsinspect, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode ad5967b 236/385: simpler installation, ELPA Syncer, 2021/10/06