Skip to content

Commit da35e4b

Browse files
committed
Replaced s-join with string-join
As per clojure-emacs#293 replacing s.el with subr-x.el All the `thread-last' got unwound due to the re-write as s.el's `s-join' expected separator first then the strings. Whereas subr-x.el's `string-join' expects strings and then the separator.
1 parent 0a25f2e commit da35e4b

File tree

1 file changed

+24
-25
lines changed

1 file changed

+24
-25
lines changed

clj-refactor.el

+24-25
Original file line numberDiff line numberDiff line change
@@ -302,11 +302,12 @@ Otherwise open the file and do the changes non-interactively."
302302
(otherwise key)))
303303

304304
(defun cljr--key-pairs-with-modifier (modifier keys)
305-
(thread-last (string-to-list keys)
306-
(seq-map (lambda (it) (cljr--fix-special-modifier-combinations
307-
(concat modifier (char-to-string it)))))
308-
(s-join " ")
309-
(read-kbd-macro)))
305+
(read-kbd-macro
306+
(string-join
307+
(seq-map
308+
(lambda (it)
309+
(cljr--fix-special-modifier-combinations (concat modifier (char-to-string it))))
310+
(string-to-list keys)) " ")))
310311

311312
(defun cljr--key-pairs-with-prefix (prefix keys)
312313
(read-kbd-macro (concat prefix " " keys)))
@@ -1340,7 +1341,7 @@ See: https://github.com/clojure-emacs/clj-refactor.el/wiki/cljr-move-form"
13401341
(re-search-forward ns)
13411342
(paredit-forward-up)
13421343
(backward-char)
1343-
(insert " :refer [" (s-join " " refer-names) "]")))
1344+
(insert " :refer [" (string-join refer-names " ") "]")))
13441345

13451346
(defun cljr--append-names-to-refer (ns names)
13461347
"Append NAMES to the :refer vector for NS"
@@ -1351,7 +1352,7 @@ See: https://github.com/clojure-emacs/clj-refactor.el/wiki/cljr-move-form"
13511352
(re-search-forward ":refer")
13521353
(paredit-forward)
13531354
(backward-char)
1354-
(insert (format " %s" (s-join " " names)))))
1355+
(insert (format " %s" (string-join names " ")))))
13551356

13561357
(defun cljr--new-require-clause (ns &optional refer-names)
13571358
"Creates a new :require clause for NS.
@@ -1708,7 +1709,7 @@ See: https://github.com/clojure-emacs/clj-refactor.el/wiki/cljr-destructure-keys
17081709
(when (looking-back "\\s_\\|\\sw" 3)
17091710
(paredit-backward))
17101711
(kill-sexp)
1711-
(insert "{:keys [" (s-join " " (seq-uniq (reverse symbols))) "]"
1712+
(insert "{:keys [" (string-join (seq-uniq (reverse symbols)) " ") "]"
17121713
(if include-as (concat " :as " symbol) "") "}")))
17131714

17141715
;; ------ Cycling ----------
@@ -1948,7 +1949,7 @@ See: https://github.com/clojure-emacs/clj-refactor.el/wiki/cljr-project-clean"
19481949
(goto-char (point-min))
19491950
(while (not (cljr--empty-buffer-p))
19501951
(push (cljr--extract-next-dependency-name) names))
1951-
(s-join "\n "(seq-sort #'string< names)))))
1952+
(string-join (seq-sort #'string< names) "\n "))))
19521953

19531954
(defun cljr--prepare-sort-buffer (sorted-names vectors-and-meta dividing-line)
19541955
(insert sorted-names)
@@ -2556,11 +2557,11 @@ Also adds the alias prefix to all occurrences of public symbols in the namespace
25562557
(seq-partition 2)))))
25572558
(when (not (= 0 (length asts-in-bad-state)))
25582559
(user-error (concat "Some namespaces are in a bad state: "
2559-
(thread-last asts-in-bad-state
2560-
(seq-map
2561-
(lambda (it)
2562-
(format "error \"%s\" in %s" (car (last (car (last it)))) (car it))))
2563-
(s-join "; ")))))))
2560+
(string-join
2561+
(seq-map
2562+
(lambda (it)
2563+
(format "error \"%s\" in %s" (car (last (car (last it)))) (car it)))
2564+
asts-in-bad-state) "; "))))))
25642565

25652566
(defun cljr--warm-ast-cache ()
25662567
(cljr--call-middleware-async
@@ -2636,7 +2637,7 @@ str/split => str
26362637
split => ''"
26372638
(cond ((cljr--qualified-symbol-p symbol) (car (s-split "/" symbol)))
26382639
((s-matches-p "\\w+\\.\\w+" symbol)
2639-
(s-join "." (butlast (s-split "\\." symbol))))
2640+
(string-join (butlast (s-split "\\." symbol)) "."))
26402641
(t "")))
26412642

26422643
(defun cljr--insert-missing-require (symbol missing-symbol type)
@@ -2832,11 +2833,11 @@ See: https://github.com/clojure-emacs/clj-refactor.el/wiki/cljr-hotload-dependen
28322833
" "))))
28332834

28342835
(defun cljr--call-middleware-to-find-used-locals (file line column)
2835-
(s-join " "
2836-
(cljr--call-middleware-sync
2837-
(cljr--create-msg "find-used-locals" "file" file "line" line
2838-
"column" column)
2839-
"used-locals")))
2836+
(string-join
2837+
(cljr--call-middleware-sync
2838+
(cljr--create-msg "find-used-locals" "file" file "line" line
2839+
"column" column)
2840+
"used-locals") " "))
28402841

28412842
(defun cljr--goto-enclosing-sexp ()
28422843
(let ((sexp-regexp (rx (or "(" "#{" "{" "["))))
@@ -3447,9 +3448,7 @@ at PATH."
34473448
(stub (s-concat (cljr--defn-str path)
34483449
(if path (cljr--symbol-suffix name) name)
34493450
" ["
3450-
(thread-last args
3451-
(seq-map-indexed params)
3452-
(s-join " "))
3451+
(string-join (seq-map-indexed params args) " ")
34533452
"]\n$0)")))
34543453
(when path
34553454
(find-file-other-window path)
@@ -3646,7 +3645,7 @@ Updates the names of the function parameters."
36463645
parameter))
36473646
(delete-region (point) (cljr--point-after
36483647
'cljr--skip-past-whitespace-and-comments))
3649-
(s-join " " (nreverse parameter))))
3648+
(string-join (nreverse parameter) " ")))
36503649

36513650
(defun cljr--maybe-wrap-form ()
36523651
"Insert newlines in or prior to the current form to prevent long lines.
@@ -3900,7 +3899,7 @@ Point is assumed to be at the function being called."
39003899
# RET or C-c C-c when you're happy with your changes.
39013900
# q or C-c C-k to abort. ")
39023901
(goto-char (point-min))
3903-
(insert (s-join "\n" params))
3902+
(insert (string-join params "\n"))
39043903
(forward-line -1)
39053904
(when (looking-at-p "&")
39063905
(forward-line 1)

0 commit comments

Comments
 (0)