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
(defonce old-print-method-impl print-method) ; the clojure.lang.MultiFn instance itself | |
(def ^:dynamic *overriding-print-method* false) | |
(defn print-method-override-dispatch [x writer] | |
(if *overriding-print-method* | |
(type x) | |
:default)) | |
(defmulti print-method-override #'print-method-override-dispatch) |
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
(ns miracle.tools.save | |
(:require [clojure.walk :refer [postwalk]])) | |
(def ^:dynamic *max-saves* 1000000000) | |
(defn gensym? [s] | |
(re-find #"__\d+" s)) | |
(defn fn->var | |
"Takes a function and returns a var. Works even on function objects." |
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
(require 'monroe) | |
(add-hook 'clojure-mode-hook 'clojure-enable-monroe) | |
(defvar *monroe-project-path* nil) | |
(defun monroe-new-session-handler (process) | |
"Returns callback that is called when new connection is established." | |
(lambda (response) | |
(monroe-dbind-response response (id new-session) | |
(when new-session |
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
(defun inf-clojure-eval-in-ns (nsn command) | |
(interactive "sNamespace to go to: \nsCommand: ") | |
(inf-clojure--process-response | |
(concat "(do (if-not (find-ns '" nsn ") (try (require '" nsn " :reload) (catch Exception e (ns " nsn " )))) (in-ns '" nsn ")" command ")") | |
(inf-clojure-proc))) | |
(defun inf-clojure-eval-in-ns-of-current-file (command) | |
(interactive "sCommand: ") | |
(if-let ((ns (clojure-find-ns))) | |
(inf-clojure-eval-in-ns ns command) |
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
(defn contextual-eval [ctx expr] | |
(eval | |
`(let [~@(mapcat (fn [[k v]] [k `'~v]) ctx)] | |
~expr))) | |
(defn readr [prompt exit-code] | |
(let [input (clojure.main/repl-read prompt exit-code)] | |
(if (= input ::tl) | |
exit-code |
NewerOlder