File tree Expand file tree Collapse file tree 3 files changed +8
-3
lines changed Expand file tree Collapse file tree 3 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ Changes can be:
15
15
16
16
* 🔌 Make websocket reconnect automatically on close to avoid having to reload the page
17
17
* 💫 Cache expressions that return ` nil ` in memory
18
+ * 🐜 Ensure custom ` print-method ` supporting unreadable symbols preserves metadata
18
19
19
20
## 0.13.842 (2023-03-07)
20
21
Original file line number Diff line number Diff line change 343
343
#?(:clj
344
344
(defmethod print-method clojure.lang.Keyword [o w]
345
345
(if (roundtrippable? o)
346
- (.write w ( str o) )
346
+ (print-simple o w )
347
347
(.write w (pr-str (->viewer-eval (if-let [ns (namespace o)]
348
348
(list 'keyword ns (name o))
349
349
(list 'keyword (name o)))))))))
352
352
(defmethod print-method clojure.lang.Symbol [o w]
353
353
(if (or (roundtrippable? o)
354
354
(= (name o) " ?@" )) ; ; splicing reader conditional, see issue #338
355
- (.write w ( str o) )
355
+ (print-simple o w )
356
356
(.write w (pr-str (->viewer-eval (if-let [ns (namespace o)]
357
357
(list 'symbol ns (name o))
358
358
(list 'symbol (name o)))))))))
Original file line number Diff line number Diff line change 354
354
(pr-str (symbol " ~" )))))
355
355
356
356
(testing " splicing reader conditional prints normally (issue #338)"
357
- (is (= " ?@" (pr-str (symbol " ?@" ))))))
357
+ (is (= " ?@" (pr-str (symbol " ?@" )))))
358
+
359
+ (testing " custom print-method for symbol preserves metadata"
360
+ (is (-> (binding [*print-meta* true ]
361
+ (pr-str '[^:foo bar])) read-string first meta :foo ))))
358
362
359
363
(deftest removed-metadata
360
364
(is (= " (do 'this)"
You can’t perform that action at this time.
0 commit comments