Last active
September 4, 2019 11:09
-
-
Save pfig/aea7e8d4994ecd01de9a15090bc3544e to your computer and use it in GitHub Desktop.
Tidal startup errors in emacs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- $ ghc-pkg describe $(ghc-pkg latest tidal) | grep data-dir | cut -f2 -d ' ' | |
-- /Users/pfig/.cabal/share/x86_64-osx-ghc-8.6.5/tidal-1.4.3 | |
-- $ cat /Users/pfig/.cabal/share/x86_64-osx-ghc-8.6.5/tidal-1.4.3/BootTidal.hs | |
:set -XOverloadedStrings | |
:set prompt "" | |
:set prompt-cont "" | |
import Sound.Tidal.Context | |
-- total latency = oLatency + cFrameTimespan | |
tidal <- startTidal (superdirtTarget {oLatency = 0.1, oAddress = "127.0.0.1", oPort = 57120}) (defaultConfig {cFrameTimespan = 1/20}) | |
:{ | |
let p = streamReplace tidal | |
hush = streamHush tidal | |
list = streamList tidal | |
mute = streamMute tidal | |
unmute = streamUnmute tidal | |
solo = streamSolo tidal | |
unsolo = streamUnsolo tidal | |
once = streamOnce tidal | |
asap = once | |
nudgeAll = streamNudgeAll tidal | |
all = streamAll tidal | |
resetCycles = streamResetCycles tidal | |
setcps = asap . cps | |
xfade i = transition tidal True (Sound.Tidal.Transition.xfadeIn 4) i | |
xfadeIn i t = transition tidal True (Sound.Tidal.Transition.xfadeIn t) i | |
histpan i t = transition tidal True (Sound.Tidal.Transition.histpan t) i | |
wait i t = transition tidal True (Sound.Tidal.Transition.wait t) i | |
waitT i f t = transition tidal True (Sound.Tidal.Transition.waitT f t) i | |
jump i = transition tidal True (Sound.Tidal.Transition.jump) i | |
jumpIn i t = transition tidal True (Sound.Tidal.Transition.jumpIn t) i | |
jumpIn' i t = transition tidal True (Sound.Tidal.Transition.jumpIn' t) i | |
jumpMod i t = transition tidal True (Sound.Tidal.Transition.jumpMod t) i | |
mortal i lifespan release = transition tidal True (Sound.Tidal.Transition.mortal lifespan release) i | |
interpolate i = transition tidal True (Sound.Tidal.Transition.interpolate) i | |
interpolateIn i t = transition tidal True (Sound.Tidal.Transition.interpolateIn t) i | |
clutch i = transition tidal True (Sound.Tidal.Transition.clutch) i | |
clutchIn i t = transition tidal True (Sound.Tidal.Transition.clutchIn t) i | |
anticipate i = transition tidal True (Sound.Tidal.Transition.anticipate) i | |
anticipateIn i t = transition tidal True (Sound.Tidal.Transition.anticipateIn t) i | |
forId i t = transition tidal False (Sound.Tidal.Transition.mortalOverlay t) i | |
d1 = p 1 . (|< orbit 0) | |
d2 = p 2 . (|< orbit 1) | |
d3 = p 3 . (|< orbit 2) | |
d4 = p 4 . (|< orbit 3) | |
d5 = p 5 . (|< orbit 4) | |
d6 = p 6 . (|< orbit 5) | |
d7 = p 7 . (|< orbit 6) | |
d8 = p 8 . (|< orbit 7) | |
d9 = p 9 . (|< orbit 8) | |
d10 = p 10 . (|< orbit 9) | |
d11 = p 11 . (|< orbit 10) | |
d12 = p 12 . (|< orbit 11) | |
d13 = p 13 | |
d14 = p 14 | |
d15 = p 15 | |
d16 = p 16 | |
:} | |
:{ | |
let setI = streamSetI tidal | |
setF = streamSetF tidal | |
setS = streamSetS tidal | |
setR = streamSetI tidal | |
setB = streamSetB tidal | |
:} | |
:set prompt "tidal> " |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Emacs 26.1, Tidal 1.4.3 | |
GHCi, version 8.6.5: http://www.haskell.org/ghc/ :? for help | |
Prelude> | |
<interactive>:3:18: error: | |
Variable not in scope: bpsUtils :: IO (a0, b0) | |
<interactive>:4:12: error: | |
Variable not in scope: superDirtSetters :: t0 -> IO (a0, b0) | |
<interactive>:4:29: error: Variable not in scope: getNow | |
<interactive>:5:12: error: | |
Variable not in scope: superDirtSetters :: t0 -> IO (a0, b0) | |
<interactive>:5:29: error: Variable not in scope: getNow | |
<interactive>:6:12: error: | |
Variable not in scope: superDirtSetters :: t0 -> IO (a0, b0) | |
<interactive>:6:29: error: Variable not in scope: getNow | |
<interactive>:7:12: error: | |
Variable not in scope: superDirtSetters :: t0 -> IO (a0, b0) | |
<interactive>:7:29: error: Variable not in scope: getNow | |
<interactive>:8:12: error: | |
Variable not in scope: superDirtSetters :: t0 -> IO (a0, b0) | |
<interactive>:8:29: error: Variable not in scope: getNow | |
<interactive>:9:12: error: | |
Variable not in scope: superDirtSetters :: t0 -> IO (a0, b0) | |
<interactive>:9:29: error: Variable not in scope: getNow | |
<interactive>:10:12: error: | |
Variable not in scope: superDirtSetters :: t0 -> IO (a0, b0) | |
<interactive>:10:29: error: Variable not in scope: getNow | |
<interactive>:11:12: error: | |
Variable not in scope: superDirtSetters :: t0 -> IO (a0, b0) | |
<interactive>:11:29: error: Variable not in scope: getNow | |
<interactive>:12:12: error: | |
Variable not in scope: superDirtSetters :: t0 -> IO (a0, b0) | |
<interactive>:12:29: error: Variable not in scope: getNow | |
<interactive>:13:14: error: | |
Variable not in scope: superDirtSetters :: t0 -> IO (a0, b0) | |
<interactive>:13:31: error: Variable not in scope: getNow | |
<interactive>:14:13: error: | |
Variable not in scope: dirtSetters :: t0 -> IO (a0, b0) | |
<interactive>:14:25: error: Variable not in scope: getNow | |
<interactive>:15:13: error: | |
Variable not in scope: dirtSetters :: t0 -> IO (a0, b0) | |
<interactive>:15:25: error: Variable not in scope: getNow | |
<interactive>:16:13: error: | |
Variable not in scope: dirtSetters :: t0 -> IO (a0, b0) | |
<interactive>:16:25: error: Variable not in scope: getNow | |
<interactive>:17:13: error: | |
Variable not in scope: dirtSetters :: t0 -> IO (a0, b0) | |
<interactive>:17:25: error: Variable not in scope: getNow | |
<interactive>:18:13: error: | |
Variable not in scope: dirtSetters :: t0 -> IO (a0, b0) | |
<interactive>:18:25: error: Variable not in scope: getNow | |
<interactive>:19:13: error: | |
Variable not in scope: dirtSetters :: t0 -> IO (a0, b0) | |
<interactive>:19:25: error: Variable not in scope: getNow | |
<interactive>:20:13: error: | |
Variable not in scope: dirtSetters :: t0 -> IO (a0, b0) | |
<interactive>:20:25: error: Variable not in scope: getNow | |
<interactive>:21:13: error: | |
Variable not in scope: dirtSetters :: t0 -> IO (a0, b0) | |
<interactive>:21:25: error: Variable not in scope: getNow | |
<interactive>:22:13: error: | |
Variable not in scope: dirtSetters :: t0 -> IO (a0, b0) | |
<interactive>:22:25: error: Variable not in scope: getNow | |
<interactive>:23:15: error: | |
Variable not in scope: dirtSetters :: t0 -> IO (a0, b0) | |
<interactive>:23:27: error: Variable not in scope: getNow | |
<interactive>:25:31: error: | |
• Variable not in scope: c1 :: Pattern a0 -> m b0 | |
• Perhaps you meant one of these: | |
‘cB’ (imported from Sound.Tidal.Context), | |
‘cF’ (imported from Sound.Tidal.Context), | |
‘cI’ (imported from Sound.Tidal.Context) | |
<interactive>:25:34: error: | |
• Variable not in scope: c2 :: Pattern a0 -> m b0 | |
• Perhaps you meant one of these: | |
‘cB’ (imported from Sound.Tidal.Context), | |
‘cF’ (imported from Sound.Tidal.Context), | |
‘cI’ (imported from Sound.Tidal.Context) | |
<interactive>:25:37: error: | |
• Variable not in scope: c3 :: Pattern a0 -> m b0 | |
• Perhaps you meant one of these: | |
‘cB’ (imported from Sound.Tidal.Context), | |
‘cF’ (imported from Sound.Tidal.Context), | |
‘cI’ (imported from Sound.Tidal.Context) | |
<interactive>:25:40: error: | |
• Variable not in scope: c4 :: Pattern a0 -> m b0 | |
• Perhaps you meant one of these: | |
‘cB’ (imported from Sound.Tidal.Context), | |
‘cF’ (imported from Sound.Tidal.Context), | |
‘cI’ (imported from Sound.Tidal.Context) | |
<interactive>:25:43: error: | |
• Variable not in scope: c5 :: Pattern a0 -> m b0 | |
• Perhaps you meant one of these: | |
‘cB’ (imported from Sound.Tidal.Context), | |
‘cF’ (imported from Sound.Tidal.Context), | |
‘cI’ (imported from Sound.Tidal.Context) | |
<interactive>:25:46: error: | |
• Variable not in scope: c6 :: Pattern a0 -> m b0 | |
• Perhaps you meant one of these: | |
‘cB’ (imported from Sound.Tidal.Context), | |
‘cF’ (imported from Sound.Tidal.Context), | |
‘cI’ (imported from Sound.Tidal.Context) | |
<interactive>:25:49: error: | |
• Variable not in scope: c7 :: Pattern a0 -> m b0 | |
• Perhaps you meant one of these: | |
‘cB’ (imported from Sound.Tidal.Context), | |
‘cF’ (imported from Sound.Tidal.Context), | |
‘cI’ (imported from Sound.Tidal.Context) | |
<interactive>:25:52: error: | |
• Variable not in scope: c8 :: Pattern a0 -> m b0 | |
• Perhaps you meant one of these: | |
‘cB’ (imported from Sound.Tidal.Context), | |
‘cF’ (imported from Sound.Tidal.Context), | |
‘cI’ (imported from Sound.Tidal.Context) | |
<interactive>:25:55: error: | |
• Variable not in scope: c9 :: Pattern a0 -> m b0 | |
• Perhaps you meant one of these: | |
‘cB’ (imported from Sound.Tidal.Context), | |
‘cF’ (imported from Sound.Tidal.Context), | |
‘cI’ (imported from Sound.Tidal.Context) | |
<interactive>:25:58: error: | |
• Variable not in scope: c10 :: Pattern a0 -> m b0 | |
• Perhaps you meant one of these: | |
‘cB0’ (imported from Sound.Tidal.Context), | |
‘cF0’ (imported from Sound.Tidal.Context), | |
‘cI0’ (imported from Sound.Tidal.Context) | |
<interactive>:25:62: error: | |
Variable not in scope: d1 :: Pattern a0 -> m b0 | |
<interactive>:25:65: error: | |
Variable not in scope: d2 :: Pattern a0 -> m b0 | |
<interactive>:25:68: error: | |
Variable not in scope: d3 :: Pattern a0 -> m b0 | |
<interactive>:25:71: error: | |
Variable not in scope: d4 :: Pattern a0 -> m b0 | |
<interactive>:25:74: error: | |
Variable not in scope: d5 :: Pattern a0 -> m b0 | |
<interactive>:25:77: error: | |
Variable not in scope: d6 :: Pattern a0 -> m b0 | |
<interactive>:25:80: error: | |
Variable not in scope: d7 :: Pattern a0 -> m b0 | |
<interactive>:25:83: error: | |
Variable not in scope: d8 :: Pattern a0 -> m b0 | |
<interactive>:25:86: error: | |
Variable not in scope: d9 :: Pattern a0 -> m b0 | |
<interactive>:25:89: error: | |
Variable not in scope: d10 :: Pattern a0 -> m b0 | |
<interactive>:26:17: error: Variable not in scope: hush :: m a0 | |
tidal> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Retrieved from https://raw.githubusercontent.com/tidalcycles/Tidal/master/tidal.el | |
;; on 04/09/2019 | |
;; | |
;;; tidal.el --- Interact with TidalCycles for live coding patterns -*- lexical-binding: t; -*- | |
;; Copyright (C) 2012 [email protected] | |
;; Copyright (C) 2006-2008 rohan drape (hsc3.el) | |
;; Author: [email protected] | |
;; Homepage: https://github.com/tidalcycles/Tidal | |
;; Version: 0 | |
;; Keywords: tools | |
;; Package-Requires: ((haskell-mode "16") (emacs "24")) | |
;; This program is free software; you can redistribute it and/or modify | |
;; it under the terms of the GNU General Public License as published by | |
;; the Free Software Foundation, either version 3 of the License, or | |
;; (at your option) any later version. | |
;; This program is distributed in the hope that it will be useful, | |
;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
;; GNU General Public License for more details. | |
;; You should have received a copy of the GNU General Public License | |
;; along with this program. If not, see <https://www.gnu.org/licenses/>. | |
;;; Commentary: | |
;; notes from hsc3: | |
;; This mode is implemented as a derivation of `haskell' mode, | |
;; indentation and font locking is courtesy that mode. The | |
;; inter-process communication is courtesy `comint'. The symbol at | |
;; point acquisition is courtesy `thingatpt'. The directory search | |
;; facilities are courtesy `find-lisp'. | |
;;; Code: | |
(require 'scheme) | |
(require 'comint) | |
(require 'thingatpt) | |
(require 'find-lisp) | |
(require 'pulse) | |
(require 'haskell-mode) | |
(defvar tidal-buffer | |
"*tidal*" | |
"*The name of the tidal process buffer (default=*tidal*).") | |
(defvar tidal-interpreter | |
"ghci" | |
"*The haskell interpeter to use (default=ghci).") | |
(defvar tidal-interpreter-version | |
(substring (shell-command-to-string (concat tidal-interpreter " --numeric-version")) 0 -1) | |
"*The version of tidal interpreter as a string.") | |
(defvar tidal-interpreter-arguments | |
() | |
"*Arguments to the haskell interpreter (default=none).") | |
(defvar tidal-boot-script-path | |
(concat (substring | |
(shell-command-to-string | |
"ghc-pkg describe $(ghc-pkg latest tidal) | grep data-dir | cut -f2 -d' '") 0 -1) | |
"/BootTidal.hs") | |
"*Full path to BootTidal.hs (inferred by introspecting ghc-pkg package db)." | |
) | |
(defvar tidal-literate-p | |
t | |
"*Flag to indicate if we are in literate mode (default=t).") | |
(defvar tidal-modules nil | |
"Additional module imports. See `tidal-run-region'.") | |
(make-variable-buffer-local 'tidal-literate-p) | |
(defun tidal-unlit (s) | |
"Remove bird literate marks in S." | |
(replace-regexp-in-string "^> " "" s)) | |
(defun tidal-intersperse (e l) | |
"Insert E between every element of list L." | |
(when l | |
(cons e (cons (car l) (tidal-intersperse e (cdr l)))))) | |
(defun tidal-start-haskell () | |
"Start haskell." | |
(interactive) | |
(if (comint-check-proc tidal-buffer) | |
(error "A tidal process is already running") | |
(apply | |
'make-comint | |
"tidal" | |
tidal-interpreter | |
nil | |
tidal-interpreter-arguments) | |
(tidal-see-output)) | |
(tidal-send-string (concat ":script " tidal-boot-script-path)) | |
) | |
(defun tidal-see-output () | |
"Show haskell output." | |
(interactive) | |
(when (comint-check-proc tidal-buffer) | |
(delete-other-windows) | |
(split-window-vertically) | |
(with-current-buffer tidal-buffer | |
(let ((window (display-buffer (current-buffer)))) | |
(goto-char (point-max)) | |
(save-selected-window | |
(set-window-point window (point-max))))))) | |
(defun tidal-quit-haskell () | |
"Quit haskell." | |
(interactive) | |
(kill-buffer tidal-buffer) | |
(delete-other-windows)) | |
(defun tidal-chunk-string (n s) | |
"Split a string S into chunks of N characters." | |
(let* ((l (length s)) | |
(m (min l n)) | |
(c (substring s 0 m))) | |
(if (<= l n) | |
(list c) | |
(cons c (tidal-chunk-string n (substring s n)))))) | |
(defun tidal-send-string (s) | |
(if (comint-check-proc tidal-buffer) | |
(let ((cs (tidal-chunk-string 64 (concat s "\n")))) | |
(mapcar (lambda (c) (comint-send-string tidal-buffer c)) cs)) | |
(error "no tidal process running?"))) | |
(defun tidal-transform-and-store (f s) | |
"Transform example text into compilable form." | |
(with-temp-file f | |
(mapc (lambda (module) | |
(insert (concat module "\n"))) | |
tidal-modules) | |
(insert "main = do\n") | |
(insert (if tidal-literate-p (tidal-unlit s) s)))) | |
(defun tidal-get-now () | |
"Store the current cycle position in a variable called 'now'." | |
(interactive) | |
(tidal-send-string "now' <- getNow") | |
(tidal-send-string "let now = nextSam now'") | |
(tidal-send-string "let retrig = (now `rotR`)") | |
(tidal-send-string "let fadeOut n = spread' (_degradeBy) (retrig $ slow n $ envL)") | |
(tidal-send-string "let fadeIn n = spread' (_degradeBy) (retrig $ slow n $ (1-) <$> envL)") | |
) | |
(defun tidal-run-line () | |
"Send the current line to the interpreter." | |
(interactive) | |
;(tidal-get-now) | |
(let* ((s (buffer-substring (line-beginning-position) | |
(line-end-position))) | |
(s* (if tidal-literate-p | |
(tidal-unlit s) | |
s))) | |
(tidal-send-string s*)) | |
(pulse-momentary-highlight-one-line (point)) | |
(forward-line) | |
) | |
(defun tidal-eval-multiple-lines () | |
"Eval the current region in the interpreter as a single line." | |
;(tidal-get-now) | |
(mark-paragraph) | |
(let* ((s (buffer-substring-no-properties (region-beginning) | |
(region-end))) | |
(s* (if tidal-literate-p | |
(tidal-unlit s) | |
s))) | |
(tidal-send-string ":{") | |
(tidal-send-string s*) | |
(tidal-send-string ":}") | |
(mark-paragraph) | |
(pulse-momentary-highlight-region (mark) (point)) | |
) | |
) | |
(defun tidal-run-multiple-lines () | |
"Send the current region to the interpreter as a single line." | |
(interactive) | |
(if (>= emacs-major-version 25) | |
(save-mark-and-excursion | |
(tidal-eval-multiple-lines)) | |
(save-excursion | |
(tidal-eval-multiple-lines)) | |
) | |
) | |
(defun tidal-run-d1 () | |
"Send the first instance of d1 to the interpreter as a single line." | |
(interactive) | |
(goto-char 0) | |
(search-forward "d1" nil nil 1) | |
(tidal-run-multiple-lines) | |
) | |
(defun tidal-run-d2 () | |
"Send the d2 to the interpreter as a single line." | |
(interactive) | |
(goto-char 0) | |
(search-forward "d2" nil nil 1) | |
(tidal-run-multiple-lines) | |
) | |
(defun tidal-run-d3 () | |
"Send the d3 to the interpreter as a single line." | |
(interactive) | |
(goto-char 0) | |
(search-forward "d3" nil nil 1) | |
(tidal-run-multiple-lines) | |
) | |
(defun tidal-run-d4 () | |
"Send the d4 to the interpreter as a single line." | |
(interactive) | |
(goto-char 0) | |
(search-forward "d4" nil nil 1) | |
(tidal-run-multiple-lines) | |
) | |
(defun tidal-run-d5 () | |
"Send the d5 to the interpreter as a single line." | |
(interactive) | |
(goto-char 0) | |
(search-forward "d5" nil nil 1) | |
(tidal-run-multiple-lines) | |
) | |
(defun tidal-run-d6 () | |
"Send the d6 to the interpreter as a single line." | |
(interactive) | |
(goto-char 0) | |
(search-forward "d6" nil nil 1) | |
(tidal-run-multiple-lines) | |
) | |
(defun tidal-run-d7 () | |
"Send the d7 to the interpreter as a single line." | |
(interactive) | |
(goto-char 0) | |
(search-forward "d7" nil nil 1) | |
(tidal-run-multiple-lines) | |
) | |
(defun tidal-run-d8 () | |
"Send the d9 to the interpreter as a single line." | |
(interactive) | |
(goto-char 0) | |
(search-forward "d8" nil nil 1) | |
(tidal-run-multiple-lines) | |
) | |
(defun tidal-run-d9 () | |
"Send the d9 to the interpreter as a single line." | |
(interactive) | |
(goto-char 0) | |
(search-forward "d9" nil nil 1) | |
(tidal-run-multiple-lines) | |
) | |
(defun tidal-stop-d1 () | |
"send d1 $ silence as a single line" | |
(interactive) | |
(tidal-send-string ":{") | |
(tidal-send-string " mapM_ ($ silence) [d1]") | |
(tidal-send-string ":}") | |
) | |
(defun tidal-stop-d2 () | |
"send d1 $ silence as a single line" | |
(interactive) | |
(tidal-send-string ":{") | |
(tidal-send-string " mapM_ ($ silence) [d2]") | |
(tidal-send-string ":}") | |
) | |
(defun tidal-stop-d3 () | |
"send d1 $ silence as a single line" | |
(interactive) | |
(tidal-send-string ":{") | |
(tidal-send-string " mapM_ ($ silence) [d3]") | |
(tidal-send-string ":}") | |
) | |
(defun tidal-stop-d4 () | |
"send d1 $ silence as a single line" | |
(interactive) | |
(tidal-send-string ":{") | |
(tidal-send-string " mapM_ ($ silence) [d4]") | |
(tidal-send-string ":}") | |
) | |
(defun tidal-stop-d5 () | |
"send d1 $ silence as a single line" | |
(interactive) | |
(tidal-send-string ":{") | |
(tidal-send-string " mapM_ ($ silence) [d5]") | |
(tidal-send-string ":}") | |
) | |
(defun tidal-stop-d6 () | |
"send d1 $ silence as a single line" | |
(interactive) | |
(tidal-send-string ":{") | |
(tidal-send-string " mapM_ ($ silence) [d6]") | |
(tidal-send-string ":}") | |
) | |
(defun tidal-stop-d7 () | |
"send d1 $ silence as a single line" | |
(interactive) | |
(tidal-send-string ":{") | |
(tidal-send-string " mapM_ ($ silence) [d7]") | |
(tidal-send-string ":}") | |
) | |
(defun tidal-stop-d8 () | |
"send d1 $ silence as a single line" | |
(interactive) | |
(tidal-send-string ":{") | |
(tidal-send-string " mapM_ ($ silence) [d8]") | |
(tidal-send-string ":}") | |
) | |
(defun tidal-stop-d9 () | |
"send d1 $ silence as a single line" | |
(interactive) | |
(tidal-send-string ":{") | |
(tidal-send-string " mapM_ ($ silence) [d9]") | |
(tidal-send-string ":}") | |
) | |
(defun tidal-run-region () | |
"Place the region in a do block and compile." | |
(interactive) | |
(tidal-transform-and-store | |
"/tmp/tidal.hs" | |
(buffer-substring-no-properties (region-beginning) (region-end))) | |
(tidal-send-string ":load \"/tmp/tidal.hs\"") | |
(tidal-send-string "main")) | |
(defun tidal-load-buffer () | |
"Load the current buffer." | |
(interactive) | |
(save-buffer) | |
(tidal-send-string (format ":load \"%s\"" buffer-file-name))) | |
(defun tidal-run-main () | |
"Run current main." | |
(interactive) | |
(tidal-send-string "main")) | |
(defun tidal-interrupt-haskell () | |
(interactive) | |
(if (comint-check-proc tidal-buffer) | |
(with-current-buffer tidal-buffer | |
(interrupt-process (get-buffer-process (current-buffer)))) | |
(error "no tidal process running?"))) | |
(defvar tidal-mode-map nil | |
"Tidal keymap.") | |
(defun tidal-mode-keybindings (map) | |
"Haskell Tidal keybindings." | |
(define-key map [?\C-c ?\C-s] 'tidal-start-haskell) | |
(define-key map [?\C-c ?\C-v] 'tidal-see-output) | |
(define-key map [?\C-c ?\C-q] 'tidal-quit-haskell) | |
(define-key map [?\C-c ?\C-c] 'tidal-run-line) | |
(define-key map [?\C-c ?\C-e] 'tidal-run-multiple-lines) | |
(define-key map (kbd "<C-return>") 'tidal-run-multiple-lines) | |
(define-key map [?\C-c ?\C-r] 'tidal-run-region) | |
(define-key map [?\C-c ?\C-l] 'tidal-load-buffer) | |
(define-key map [?\C-c ?\C-i] 'tidal-interrupt-haskell) | |
(define-key map [?\C-c ?\C-m] 'tidal-run-main) | |
(define-key map [?\C-c ?\C-1] 'tidal-run-d1) | |
(define-key map [?\C-c ?\C-2] 'tidal-run-d2) | |
(define-key map [?\C-c ?\C-3] 'tidal-run-d3) | |
(define-key map [?\C-c ?\C-4] 'tidal-run-d4) | |
(define-key map [?\C-c ?\C-5] 'tidal-run-d5) | |
(define-key map [?\C-c ?\C-6] 'tidal-run-d6) | |
(define-key map [?\C-c ?\C-7] 'tidal-run-d7) | |
(define-key map [?\C-c ?\C-8] 'tidal-run-d8) | |
(define-key map [?\C-c ?\C-9] 'tidal-run-d9) | |
(define-key map [?\C-v ?\C-1] 'tidal-stop-d1) | |
(define-key map [?\C-v ?\C-2] 'tidal-stop-d2) | |
(define-key map [?\C-v ?\C-3] 'tidal-stop-d3) | |
(define-key map [?\C-v ?\C-4] 'tidal-stop-d4) | |
(define-key map [?\C-v ?\C-5] 'tidal-stop-d5) | |
(define-key map [?\C-v ?\C-6] 'tidal-stop-d6) | |
(define-key map [?\C-v ?\C-7] 'tidal-stop-d7) | |
(define-key map [?\C-v ?\C-8] 'tidal-stop-d8) | |
(define-key map [?\C-v ?\C-9] 'tidal-stop-d9)) | |
(defun turn-on-tidal-keybindings () | |
"Haskell Tidal keybindings in the local map." | |
(local-set-key [?\C-c ?\C-s] 'tidal-start-haskell) | |
(local-set-key [?\C-c ?\C-v] 'tidal-see-output) | |
(local-set-key [?\C-c ?\C-q] 'tidal-quit-haskell) | |
(local-set-key [?\C-c ?\C-c] 'tidal-run-line) | |
(local-set-key [?\C-c ?\C-e] 'tidal-run-multiple-lines) | |
(local-set-key (kbd "<C-return>") 'tidal-run-multiple-lines) | |
(local-set-key [?\C-c ?\C-r] 'tidal-run-region) | |
(local-set-key [?\C-c ?\C-l] 'tidal-load-buffer) | |
(local-set-key [?\C-c ?\C-i] 'tidal-interrupt-haskell) | |
(local-set-key [?\C-c ?\C-m] 'tidal-run-main) | |
(local-set-key [?\C-c ?\C-1] 'tidal-run-d1) | |
(local-set-key [?\C-c ?\C-2] 'tidal-run-d2) | |
(local-set-key [?\C-c ?\C-3] 'tidal-run-d3) | |
(local-set-key [?\C-c ?\C-4] 'tidal-run-d4) | |
(local-set-key [?\C-c ?\C-5] 'tidal-run-d5) | |
(local-set-key [?\C-c ?\C-6] 'tidal-run-d6) | |
(local-set-key [?\C-c ?\C-7] 'tidal-run-d7) | |
(local-set-key [?\C-c ?\C-8] 'tidal-run-d8) | |
(local-set-key [?\C-c ?\C-9] 'tidal-run-d9) | |
(local-set-key [?\C-v ?\C-1] 'tidal-stop-d1) | |
(local-set-key [?\C-v ?\C-2] 'tidal-stop-d2) | |
(local-set-key [?\C-v ?\C-3] 'tidal-stop-d3) | |
(local-set-key [?\C-v ?\C-4] 'tidal-stop-d4) | |
(local-set-key [?\C-v ?\C-5] 'tidal-stop-d5) | |
(local-set-key [?\C-v ?\C-6] 'tidal-stop-d6) | |
(local-set-key [?\C-v ?\C-7] 'tidal-stop-d7) | |
(local-set-key [?\C-v ?\C-8] 'tidal-stop-d8) | |
(local-set-key [?\C-v ?\C-9] 'tidal-stop-d9)) | |
(defun tidal-mode-menu (map) | |
"Haskell Tidal menu." | |
(define-key map [menu-bar tidal] | |
(cons "Haskell-Tidal" (make-sparse-keymap "Haskell-Tidal"))) | |
(define-key map [menu-bar tidal help] | |
(cons "Help" (make-sparse-keymap "Help"))) | |
(define-key map [menu-bar tidal expression] | |
(cons "Expression" (make-sparse-keymap "Expression"))) | |
(define-key map [menu-bar tidal expression load-buffer] | |
'("Load buffer" . tidal-load-buffer)) | |
(define-key map [menu-bar tidal expression run-main] | |
'("Run main" . tidal-run-main)) | |
(define-key map [menu-bar tidal expression run-region] | |
'("Run region" . tidal-run-region)) | |
(define-key map [menu-bar tidal expression run-multiple-lines] | |
'("Run multiple lines" . tidal-run-multiple-lines)) | |
(define-key map [menu-bar tidal expression run-line] | |
'("Run line" . tidal-run-line)) | |
(define-key map [menu-bar tidal haskell] | |
(cons "Haskell" (make-sparse-keymap "Haskell"))) | |
(define-key map [menu-bar tidal haskell quit-haskell] | |
'("Quit haskell" . tidal-quit-haskell)) | |
(define-key map [menu-bar tidal haskell see-output] | |
'("See output" . tidal-see-output)) | |
(define-key map [menu-bar tidal haskell start-haskell] | |
'("Start haskell" . tidal-start-haskell))) | |
(unless tidal-mode-map | |
(let ((map (make-sparse-keymap "Haskell-Tidal"))) | |
(tidal-mode-keybindings map) | |
(tidal-mode-menu map) | |
(setq tidal-mode-map map))) | |
;;;###autoload | |
(define-derived-mode | |
literate-tidal-mode | |
tidal-mode | |
"Literate Haskell Tidal" | |
"Major mode for interacting with an inferior haskell process." | |
(set (make-local-variable 'paragraph-start) "\f\\|[ \t]*$") | |
(set (make-local-variable 'paragraph-separate) "[ \t\f]*$") | |
(setq tidal-literate-p t) | |
(setq haskell-literate 'bird) | |
(turn-on-font-lock)) | |
;;;###autoload | |
(add-to-list 'auto-mode-alist '("\\.ltidal$" . literate-tidal-mode)) | |
;;(add-to-list 'load-path "/usr/share/emacs/site-lisp/haskell-mode/") ;required by olig1905 on linux | |
;;(require 'haskell-mode) ;required by olig1905 on linux | |
;;;###autoload | |
(define-derived-mode | |
tidal-mode | |
haskell-mode | |
"Haskell Tidal" | |
"Major mode for interacting with an inferior haskell process." | |
(set (make-local-variable 'paragraph-start) "\f\\|[ \t]*$") | |
(set (make-local-variable 'paragraph-separate) "[ \t\f]*$") | |
(setq tidal-literate-p nil) | |
(turn-on-font-lock)) | |
;;;###autoload | |
(add-to-list 'auto-mode-alist '("\\.tidal$" . tidal-mode)) | |
(provide 'tidal) | |
;;; tidal.el ends here |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment