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