File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change 27
27
implementation."
28
28
false )
29
29
30
+ (defn use-positional-zipper!
31
+ " Globally activate the position-tracking zipper. You can locally revert
32
+ behaviour to `clojure.zip`'s by using `without-positional-zipper`."
33
+ []
34
+ (alter-var-root #'*active?* (constantly true )))
35
+
30
36
(defmacro ^:private defn-switchable
31
37
[sym docstring params & body]
32
38
(let [placeholders (repeatedly (count params) gensym)]
46
52
`(binding [*active?* true ]
47
53
~@body))
48
54
55
+ (defmacro without-positional-zipper
56
+ " Force usage of `clojure.zip` to evaluate any rewrite-clj zipper operations in
57
+ `body` instead of a custom position-tracking zipper."
58
+ [& body]
59
+ `(binding [*active?* true ]
60
+ ~@body))
61
+
49
62
; ; ## Implementation
50
63
51
64
(defn ^:no-doc zipper
Original file line number Diff line number Diff line change 24
24
(import-vars
25
25
[rewrite-clj.custom-zipper.core
26
26
node position root
27
- with-positional-zipper]
27
+ use-positional-zipper!
28
+ with-positional-zipper
29
+ without-positional-zipper]
28
30
29
31
[rewrite-clj.zip.base
30
32
child-sexprs
You can’t perform that action at this time.
0 commit comments