From 715fe72e49cd82c33f9cfbf6c469b96d677270c3 Mon Sep 17 00:00:00 2001
From: Linus Heckemann <git@sphalerite.org>
Date: Thu, 29 Mar 2018 10:43:42 +0100
Subject: [PATCH] Set up emacs for interactive GHOTL eval

---
 demo.nix  | 2 +-
 emacs.nix | 6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/demo.nix b/demo.nix
index 2263021..df11a16 100644
--- a/demo.nix
+++ b/demo.nix
@@ -4,5 +4,5 @@ let
   ghotl-repl = (import ./ghotl-repl.nix { inherit pkgs; });
 in mkShell {
   name = "ghotl";
-  buildInputs = [ emacs ghotl ghotl-repl ];
+  buildInputs = [ (import ./emacs.nix) ghotl ghotl-repl ];
 }
diff --git a/emacs.nix b/emacs.nix
index 4311688..ce30d40 100644
--- a/emacs.nix
+++ b/emacs.nix
@@ -11,15 +11,17 @@ let
         :config (evil-mode))
       (use-package haskell-mode
         :bind ("C-c C-c" . haskell-compile))
-      ;(use-package ghc)
       (global-whitespace-mode)
       (setq whitespace-style '(tab-mark face trailing tabs))
+      (defun ghotl-eval () "" ()
+        (shell-command-on-region (point-min) (point-max) "ghotl" "*GHOTL Output*")
+        (display-buffer "*GHOTL Output*"))
+      (global-set-key (kbd "C-c C-e") (lambda () (interactive) (ghotl-eval)))
     '';
   };
   emacs = pkgs.emacsWithPackages (ps: with ps; [
     evil markdown-mode
     haskell-mode
-    ghc-mod
     nix-mode
     magit
     use-package
-- 
GitLab