diff --git a/fnl/conjure/client/fennel/nfnl.fnl b/fnl/conjure/client/fennel/nfnl.fnl index ce5f9fcd..77bf3ab8 100644 --- a/fnl/conjure/client/fennel/nfnl.fnl +++ b/fnl/conjure/client/fennel/nfnl.fnl @@ -10,8 +10,6 @@ (local repl (autoload :conjure.nfnl.repl)) (local fs (autoload :conjure.nfnl.fs)) -;; TODO Eval and replace isn't working. - (local M (define :conjure.client.fennel.nfnl {:comment-node? ts.lisp-comment-node? @@ -88,7 +86,11 @@ (tset package.loaded mod-path (core.merge! mod (core.last results))))) (when (not (core.empty? result-strs)) - (log.append (text.split-lines (str.join "\n" result-strs)))))) + (let [result (str.join "\n" result-strs)] + (when opts.on-result + (opts.on-result result)) + + (log.append (text.split-lines result)))))) (fn M.eval-file [opts] "Client function, called by Conjure when evaluating a file from disk." diff --git a/lua/conjure/client/fennel/nfnl.lua b/lua/conjure/client/fennel/nfnl.lua index 2d60b5ba..50f7a463 100644 --- a/lua/conjure/client/fennel/nfnl.lua +++ b/lua/conjure/client/fennel/nfnl.lua @@ -83,7 +83,12 @@ M["eval-str"] = function(opts) else end if not core["empty?"](result_strs) then - return log.append(text["split-lines"](str.join("\n", result_strs))) + local result = str.join("\n", result_strs) + if opts["on-result"] then + opts["on-result"](result) + else + end + return log.append(text["split-lines"](result)) else return nil end