Skip to content

Commit 9325374

Browse files
committed
Improve the refactoring docs a bit
1 parent a1fdc69 commit 9325374

File tree

1 file changed

+40
-43
lines changed

1 file changed

+40
-43
lines changed

README.md

+40-43
Original file line numberDiff line numberDiff line change
@@ -376,27 +376,54 @@ following customization:
376376

377377
### Threading macros related features
378378

379-
`clojure-ts-thread`: Thread another form into the surrounding thread. Both
380-
`->>`/`some->>` and `->`/`some->` variants are supported.
379+
There are a bunch of commands for threading and unwinding threaded Clojure forms:
381380

382-
`clojure-ts-unwind`: Unwind a threaded expression. Supports both `->>`/`some->>`
381+
- `clojure-ts-thread`: Thread another form into the surrounding thread. Both
382+
`->>`/`some->>` and `->`/`some->` variants are supported.
383+
- `clojure-ts-unwind`: Unwind a threaded expression. Supports both `->>`/`some->>`
383384
and `->`/`some->`.
384-
385-
`clojure-ts-thread-first-all`: Introduce the thread first macro (`->`) and
385+
- `clojure-ts-thread-first-all`: Introduce the thread first macro (`->`) and
386386
rewrite the entire form. With a prefix argument do not thread the last form.
387-
388-
`clojure-ts-thread-last-all`: Introduce the thread last macro and rewrite the
387+
- `clojure-ts-thread-last-all`: Introduce the thread last macro and rewrite the
389388
entire form. With a prefix argument do not thread the last form.
390-
391-
`clojure-ts-unwind-all`: Fully unwind a threaded expression removing the
389+
- `clojure-ts-unwind-all`: Fully unwind a threaded expression removing the
392390
threading macro.
393391

392+
#### Customize threading refactoring behavior
393+
394+
By default `clojure-ts-thread-first-all` and `clojure-ts-thread-last-all` will
395+
thread all nested expressions. For example this expression:
396+
397+
```clojure
398+
(->map (assoc {} :key "value") :lock)
399+
```
400+
401+
After executing `clojure-ts-thread-last-all` will be converted to:
402+
403+
```clojure
404+
(-> {}
405+
(assoc :key "value")
406+
(->map :lock))
407+
```
408+
409+
This behavior can be changed by setting:
410+
411+
```emacs-lisp
412+
(setopt clojure-ts-thread-all-but-last t)
413+
```
414+
415+
Then the last expression will not be threaded and the result will be:
416+
417+
```clojure
418+
(-> (assoc {} :key "value")
419+
(->map :lock))
420+
```
421+
394422
### Cycling things
395423

396-
`clojure-ts-cycle-keyword-string`: Convert the string at point to a keyword and
424+
- `clojure-ts-cycle-keyword-string`: Convert the string at point to a keyword and
397425
vice versa.
398-
399-
`clojure-ts-cycle-privacy`: Cycle privacy of `def`s or `defn`s. Use metadata
426+
- `clojure-ts-cycle-privacy`: Cycle privacy of `def`s or `defn`s. Use metadata
400427
explicitly with setting `clojure-ts-use-metadata-for-defn-privacy` to `t` for
401428
`defn`s too.
402429

@@ -441,40 +468,10 @@ multi-arity function or macro. Function can be defined using `defn`, `fn` or
441468
By default prefix for all refactoring commands is `C-c C-r`. It can be changed
442469
by customizing `clojure-ts-refactor-map-prefix` variable.
443470

444-
### Customize threading refactoring behavior
445-
446-
By default `clojure-ts-thread-first-all` and `clojure-ts-thread-last-all` will
447-
thread all nested expressions. For example this expression:
448-
449-
```clojure
450-
(->map (assoc {} :key "value") :lock)
451-
```
452-
453-
After executing `clojure-ts-thread-last-all` will be converted to:
454-
455-
```clojure
456-
(-> {}
457-
(assoc :key "value")
458-
(->map :lock))
459-
```
460-
461-
This behavior can be changed by setting:
462-
463-
```emacs-lisp
464-
(setopt clojure-ts-thread-all-but-last t)
465-
```
466-
467-
Then the last expression will not be threaded and the result will be:
468-
469-
```clojure
470-
(-> (assoc {} :key "value")
471-
(->map :lock))
472-
```
473-
474471
## Migrating to clojure-ts-mode
475472

476473
If you are migrating to `clojure-ts-mode` note that `clojure-mode` is still
477-
required for cider and clj-refactor packages to work properly.
474+
required for CIDER and `clj-refactor` packages to work properly.
478475

479476
After installing the package do the following:
480477

0 commit comments

Comments
 (0)