@@ -2769,8 +2769,8 @@ With a numeric prefix argument the let is introduced N lists up."
2769
2769
(interactive )
2770
2770
(clojure--move-to-let-internal (read-from-minibuffer " Name of bound symbol: " )))
2771
2771
2772
- ; ;; Shorthand fn conversion
2773
- (defun clojure--gather-shorthand -args ()
2772
+ ; ;; Promoting #() function literals
2773
+ (defun clojure--gather-fn-literal -args ()
2774
2774
" Return a cons cell (ARITY . VARARG)
2775
2775
ARITY is number of arguments in the function,
2776
2776
VARARG is a boolean of whether it takes a variable argument %&."
@@ -2790,7 +2790,7 @@ VARARG is a boolean of whether it takes a variable argument %&."
2790
2790
(string-to-number s))))))))
2791
2791
(cons arity vararg))))
2792
2792
2793
- (defun clojure--substitute-shorthand -arg (arg sub end )
2793
+ (defun clojure--substitute-fn-literal -arg (arg sub end )
2794
2794
" ARG is either a number or the symbol '&.
2795
2795
SUB is a string to substitute with, and
2796
2796
END marks the end of the fn expression"
@@ -2801,7 +2801,7 @@ END marks the end of the fn expression"
2801
2801
(not (clojure--in-string-p)))
2802
2802
(replace-match sub))))))
2803
2803
2804
- (defun clojure-convert-shorthand-fn ()
2804
+ (defun clojure-promote-fn-literal ()
2805
2805
" Convert a #(...) function into (fn [...] ...), prompting for the argument names."
2806
2806
(interactive )
2807
2807
(when-let (beg (clojure-string-start))
@@ -2810,7 +2810,7 @@ END marks the end of the fn expression"
2810
2810
(ignore-errors (forward-char 1 ))
2811
2811
(re-search-backward " #(" (save-excursion (beginning-of-defun ) (point )) 'noerror ))
2812
2812
(let* ((end (save-excursion (clojure-forward-logical-sexp) (point-marker )))
2813
- (argspec (clojure--gather-shorthand -args))
2813
+ (argspec (clojure--gather-fn-literal -args))
2814
2814
(arity (car argspec))
2815
2815
(vararg (cdr argspec)))
2816
2816
(delete-char 1 )
@@ -2822,14 +2822,14 @@ END marks the end of the fn expression"
2822
2822
(let ((name (read-string (format " Name of argument %d : " n))))
2823
2823
(when (/= n 1 ) (insert " " ))
2824
2824
(insert name)
2825
- (clojure--substitute-shorthand -arg n name end)))
2825
+ (clojure--substitute-fn-literal -arg n name end)))
2826
2826
(number-sequence 1 arity))
2827
2827
(when vararg
2828
2828
(insert " & " )
2829
2829
(let ((name (read-string " Name of variadic argument: " )))
2830
2830
(insert name)
2831
- (clojure--substitute-shorthand -arg '& name end)))))
2832
- (user-error " No #() shorthand at point!" )))
2831
+ (clojure--substitute-fn-literal -arg '& name end)))))
2832
+ (user-error " No #() literal at point!" )))
2833
2833
2834
2834
; ;; Renaming ns aliases
2835
2835
0 commit comments