|
225 | 225 | (some-> zloc z/down ns-token?)))
|
226 | 226 |
|
227 | 227 | (defn- indent-matches? [key sym]
|
228 |
| - (if (symbol? sym) |
| 228 | + (when (symbol? sym) |
229 | 229 | (cond
|
230 | 230 | (symbol? key) (= key sym)
|
231 | 231 | (pattern? key) (re-find key (str sym)))))
|
232 | 232 |
|
233 | 233 | (defn- token-value [zloc]
|
234 |
| - (if (token? zloc) (z/sexpr zloc))) |
| 234 | + (when (token? zloc) (z/sexpr zloc))) |
235 | 235 |
|
236 | 236 | (defn- reader-conditional? [zloc]
|
237 | 237 | (and (reader-macro? zloc) (#{"?" "?@"} (-> zloc z/down token-value str))))
|
|
260 | 260 |
|
261 | 261 | (defn- inner-indent [zloc key depth idx context]
|
262 | 262 | (let [top (nth (iterate z/up zloc) depth)]
|
263 |
| - (if (and (or (indent-matches? key (fully-qualified-symbol zloc context)) |
264 |
| - (indent-matches? key (remove-namespace (form-symbol top)))) |
265 |
| - (or (nil? idx) (index-matches-top-argument? zloc depth idx))) |
| 263 | + (when (and (or (indent-matches? key (fully-qualified-symbol zloc context)) |
| 264 | + (indent-matches? key (remove-namespace (form-symbol top)))) |
| 265 | + (or (nil? idx) (index-matches-top-argument? zloc depth idx))) |
266 | 266 | (let [zup (z/up zloc)]
|
267 | 267 | (+ (margin zup) (indent-width zup))))))
|
268 | 268 |
|
269 | 269 | (defn- nth-form [zloc n]
|
270 |
| - (reduce (fn [z f] (if z (f z))) |
| 270 | + (reduce (fn [z f] (when z (f z))) |
271 | 271 | (z/leftmost zloc)
|
272 | 272 | (repeat n z/right)))
|
273 | 273 |
|
|
280 | 280 | true)))
|
281 | 281 |
|
282 | 282 | (defn- block-indent [zloc key idx context]
|
283 |
| - (if (or (indent-matches? key (fully-qualified-symbol zloc context)) |
284 |
| - (indent-matches? key (remove-namespace (form-symbol zloc)))) |
| 283 | + (when (or (indent-matches? key (fully-qualified-symbol zloc context)) |
| 284 | + (indent-matches? key (remove-namespace (form-symbol zloc)))) |
285 | 285 | (let [zloc-after-idx (some-> zloc (nth-form (inc idx)))]
|
286 | 286 | (if (and (or (nil? zloc-after-idx) (first-form-in-line? zloc-after-idx))
|
287 | 287 | (> (index-of zloc) idx))
|
|
0 commit comments