File tree Expand file tree Collapse file tree 2 files changed +35
-8
lines changed Expand file tree Collapse file tree 2 files changed +35
-8
lines changed Original file line number Diff line number Diff line change @@ -1389,7 +1389,7 @@ nil."
1389
1389
" Delete the surrounding sexp and return it."
1390
1390
(let ((begin (point )))
1391
1391
(forward-sexp )
1392
- (let ((result (buffer-substring-no-properties begin (point ))))
1392
+ (let ((result (buffer-substring begin (point ))))
1393
1393
(delete-region begin (point ))
1394
1394
result)))
1395
1395
@@ -1609,7 +1609,9 @@ Point must be between the opening paren and the -> symbol."
1609
1609
(clojure--ensure-parens-around-function-names)
1610
1610
(down-list )
1611
1611
(forward-sexp )
1612
- (insert contents)))
1612
+ (insert contents)
1613
+ (forward-sexp -1 )
1614
+ (clojure--maybe-unjoin-line)))
1613
1615
(forward-char ))
1614
1616
1615
1617
(defun clojure--pop-out-of-threading ()
@@ -1677,9 +1679,14 @@ Return nil if there are no more levels to unwind."
1677
1679
(let ((contents (clojure-delete-and-extract-sexp)))
1678
1680
(backward-up-list )
1679
1681
(just-one-space 0 )
1680
- (insert contents)
1681
- (newline-and-indent )
1682
- (clojure--remove-superfluous-parens)
1682
+ (save-excursion
1683
+ (insert contents " \n " )
1684
+ (clojure--remove-superfluous-parens))
1685
+ (when (looking-at " \\ s-*\n " )
1686
+ (join-line 'following )
1687
+ (forward-char 1 )
1688
+ (put-text-property (point ) (1+ (point ))
1689
+ 'clojure-thread-line-joined t ))
1683
1690
t )))
1684
1691
1685
1692
(defun clojure--thread-last ()
@@ -1690,8 +1697,7 @@ Return nil if there are no more levels to unwind."
1690
1697
(let ((contents (clojure-delete-and-extract-sexp)))
1691
1698
(just-one-space 0 )
1692
1699
(backward-up-list )
1693
- (insert contents)
1694
- (newline-and-indent )
1700
+ (insert contents " \n " )
1695
1701
(clojure--remove-superfluous-parens)
1696
1702
; ; cljr #255 Fix dangling parens
1697
1703
(forward-sexp )
Original file line number Diff line number Diff line change 331
331
[a b])"
332
332
(clojure-unwind-all))
333
333
334
- (def-threading-test maybe-unjoin-lines
334
+ (def-threading-test last- maybe-unjoin-lines
335
335
" (deftask dev []
336
336
(comp (serve)
337
337
(cljs (lala)
344
344
(clojure-thread-last-all nil )
345
345
(clojure-unwind-all))
346
346
347
+ (def-threading-test empty-first-line
348
+ " (map
349
+ inc
350
+ [1 2])"
351
+ " (-> inc
352
+ (map
353
+ [1 2]))"
354
+ (goto-char (point-min ))
355
+ (clojure-thread-first-all nil ))
356
+
357
+ (def-threading-test first-maybe-unjoin-lines
358
+ " (map
359
+ inc
360
+ [1 2])"
361
+ " (map
362
+ inc
363
+ [1 2])"
364
+ (goto-char (point-min ))
365
+ (clojure-thread-first-all nil )
366
+ (clojure-unwind-all))
367
+
347
368
(provide 'clojure-mode-refactor-threading-test )
348
369
349
370
; ;; clojure-mode-refactor-threading-test.el ends here
You can’t perform that action at this time.
0 commit comments