Browse Source

haskell: Use dante's GHCi instead of the one in haskell-mode

Also, add `hasky-extensions'.
master
Peter J. Jones 1 month ago
parent
commit
7c468da3f8
Signed by: Peter Jones <pjones@devalot.com> GPG Key ID: 9DAFAA8D01941E49
2 changed files with 23 additions and 14 deletions
  1. 22
    14
      modes/haskell-mode-conf.el
  2. 1
    0
      nix/packages.nix

+ 22
- 14
modes/haskell-mode-conf.el View File

@@ -15,10 +15,8 @@
15 15
 (require 'direnv)
16 16
 (require 'evil-leader)
17 17
 (require 'flycheck)
18
-(require 'haskell)
19
-(require 'haskell-interactive-mode)
20 18
 (require 'haskell-mode)
21
-(require 'haskell-process)
19
+(require 'hasky-extensions)
22 20
 
23 21
 (declare-function pjones:prog-mode-hook "../lisp/code.el")
24 22
 
@@ -27,16 +25,22 @@
27 25
   '(haskell-stylish-on-save nil)
28 26
   '(haskell-tags-on-save t)
29 27
   '(haskell-completing-read-function 'ivy-completing-read)
30
-  '(haskell-process-type 'cabal-new-repl)
31
-  '(haskell-process-suggest-hoogle-imports t)
32
-  '(dante-repl-command-line '("cabal" "new-repl")))
28
+  '(dante-repl-command-line '("nix-hs" "repl")))
33 29
 
34 30
 ;; A few extra key bindings:
35 31
 (evil-leader/set-key-for-mode 'haskell-mode
36 32
   "SPC e" #'haskell-cabal-visit-file
37 33
   "SPC i" #'haskell-navigate-imports
38 34
   "SPC s" #'haskell-sort-imports
39
-  "SPC t" #'dante-info)
35
+  "SPC t" #'dante-type-at
36
+  "SPC x" #'pjones:hasky-extensions
37
+  "SPC y" #'dante-info)
38
+
39
+(evil-leader/set-key-for-mode 'haskell-cabal-mode
40
+  "SPC s" #'haskell-cabal-subsection-arrange-lines)
41
+
42
+(evil-define-key 'normal haskell-cabal-mode-map "gj" #'haskell-cabal-next-section)
43
+(evil-define-key 'normal haskell-cabal-mode-map "gk" #'haskell-cabal-previous-section)
40 44
 
41 45
 ;; This overwrite fixes a bug where imports are not sorted because I
42 46
 ;; put a comment line above them.
@@ -45,6 +49,16 @@
45 49
   (while (looking-at "^import") (forward-line -1))
46 50
   (forward-line 1))
47 51
 
52
+(defun pjones:hasky-extensions ()
53
+  "Wrapper around `hasky-extensions'.
54
+A version of `hasky-extensions' that doesn't use avy."
55
+  (interactive)
56
+  (let* ((exts hasky-extensions)
57
+         (active (hasky-extensions-list))
58
+         (name (ivy-completing-read "Extension: " exts nil t)))
59
+    (if (member name active) (hasky-extensions-remove name)
60
+      (hasky-extensions-add name))))
61
+
48 62
 (defun pjones:haskell-mode-hook ()
49 63
   "Hook run on new Haskell buffers."
50 64
   ;; Update environment variables (i.e. PATH) first!
@@ -52,17 +66,11 @@
52 66
 
53 67
   ;; Boot `haskell-mode':
54 68
   (haskell-indentation-mode)
55
-  (interactive-haskell-mode)
56
-  (haskell-process-load-file)
57
-
58
-  ;; Configure completion:
59
-  (make-local-variable 'company-backends)
60
-  (add-to-list 'company-backends '(company-capf company-dabbrev company-abbrev))
69
+  (dante-mode)
61 70
 
62 71
   ;; Load helper packages:
63 72
   (pjones:prog-mode-hook)
64 73
   (flycheck-mode)
65
-  (dante-mode)
66 74
   (subword-mode)
67 75
   (abbrev-mode))
68 76
 

+ 1
- 0
nix/packages.nix View File

@@ -63,6 +63,7 @@ overrides.emacsWithPackages (epkgs: with epkgs; [
63 63
   git-annex                     # Mode for easy editing of git-annex'd files
64 64
   graphviz-dot-mode             # Mode for the dot-language used by graphviz
65 65
   haskell-mode                  # A Haskell editing mode
66
+  hasky-extensions              # Toggle Haskell language extensions
66 67
   htmlize                       # Convert buffer text and decorations to HTML
67 68
   http                          # Yet another HTTP client
68 69
   hydra                         # Make bindings that stick around

Loading…
Cancel
Save