Skip to content

Instantly share code, notes, and snippets.

@linktohack
Created March 18, 2022 16:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save linktohack/ac6fcac6f19546e0b803af6de526b29d to your computer and use it in GitHub Desktop.
Save linktohack/ac6fcac6f19546e0b803af6de526b29d to your computer and use it in GitHub Desktop.
Hammerspoon fennel REPL
(local fennel (require :fennel))
(require :hs.ipc)
(let [coro (coroutine.create fennel.repl)]
(coroutine.resume coro {:readChunk (fn []
(let [input (coroutine.yield)]
(.. input "\n")))
:onValues (fn [xs]
(print (table.concat xs "\t")))
:onError (fn [_ msg]
(print msg))})
(set hs._consoleInputPreparser (fn [s]
(coroutine.resume coro s)
"")))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment