From d15e6f662772519f6c16f36b6ec66d30b1c1e782 Mon Sep 17 00:00:00 2001 From: Ursa Americanus Kermodei Date: Sat, 7 Nov 2015 15:14:47 -0800 Subject: [PATCH] [ultra] Add support for Whidbey/Puget options This commit resolves https://github.com/venantius/ultra/issues/40 It allows a user to add whidbey/puget options in Ultra's `:repl` key, which will be merged into the whidbey.printer/printer options map. --- src/ultra/colorscheme.clj | 2 +- src/ultra/printer/escape_hatch.clj | 18 ------------------ src/ultra/repl.clj | 5 +++-- src/ultra/test.clj | 1 - 4 files changed, 4 insertions(+), 22 deletions(-) delete mode 100644 src/ultra/printer/escape_hatch.clj diff --git a/src/ultra/colorscheme.clj b/src/ultra/colorscheme.clj index 1b13839..af9edc4 100644 --- a/src/ultra/colorscheme.clj +++ b/src/ultra/colorscheme.clj @@ -62,5 +62,5 @@ (alter-var-root #'whidbey.repl/printer merge - (assoc opts :color-scheme color-scheme)) + {:color-scheme color-scheme}) (set-pretty-colors color-scheme))) diff --git a/src/ultra/printer/escape_hatch.clj b/src/ultra/printer/escape_hatch.clj deleted file mode 100644 index e9d635d..0000000 --- a/src/ultra/printer/escape_hatch.clj +++ /dev/null @@ -1,18 +0,0 @@ -(ns ultra.printer.escape-hatch - "Hooks into `puget.printer` that are intended as an escape hatch for - custom data types." - #_(:require [puget.data :as data] - [puget.printer :refer [format-doc]]) - ) - -#_(def escaped-classes - #{"class datomic.db.Db"}) - -#_(intern - 'puget.printer - 'formatter-dispatch - (fn [value] - (cond - (satisfies? data/ExtendedNotation value) ::tagged-literal - (escaped-classes (str (class value))) :default - :else (type value)))) diff --git a/src/ultra/repl.clj b/src/ultra/repl.clj index 009aabe..10d97da 100644 --- a/src/ultra/repl.clj +++ b/src/ultra/repl.clj @@ -4,8 +4,7 @@ [clojure.tools.nrepl.server] [glow.core :as glow] [io.aviso.repl :as pretty-repl] - [ultra.printer :refer [cprint]] - [ultra.printer.escape-hatch])) + [ultra.printer :refer [cprint]])) (defmacro source "Prints the source code for the given symbol, if it can find it. @@ -57,7 +56,9 @@ [repl stacktraces] (when (not (false? repl)) (require 'ultra.repl.whidbey) + (require 'whidbey.repl) (eval '(ultra.repl.whidbey/add-whidbey-middleware)) + (eval `(whidbey.repl/update-options! ~repl)) (replace-source)) (when (not (false? stacktraces)) (add-pretty-middleware))) diff --git a/src/ultra/test.clj b/src/ultra/test.clj index d490f84..daa7a7d 100644 --- a/src/ultra/test.clj +++ b/src/ultra/test.clj @@ -3,7 +3,6 @@ (:require [clojure.data :as data] [clojure.pprint :as pp] [puget.color.ansi :as ansi] - [puget.printer :as printer] [ultra.test.diff :as diff]))