@@ -2769,8 +2769,8 @@ With a numeric prefix argument the let is introduced N lists up."
27692769 (interactive )
27702770 (clojure--move-to-let-internal (read-from-minibuffer " Name of bound symbol: " )))
27712771
2772- ; ;; Shorthand fn conversion
2773- (defun clojure--gather-shorthand -args ()
2772+ ; ;; Promoting #() function literals
2773+ (defun clojure--gather-fn-literal -args ()
27742774 " Return a cons cell (ARITY . VARARG)
27752775ARITY is number of arguments in the function,
27762776VARARG 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 %&."
27902790 (string-to-number s))))))))
27912791 (cons arity vararg))))
27922792
2793- (defun clojure--substitute-shorthand -arg (arg sub end )
2793+ (defun clojure--substitute-fn-literal -arg (arg sub end )
27942794 " ARG is either a number or the symbol '&.
27952795SUB is a string to substitute with, and
27962796END marks the end of the fn expression"
@@ -2801,7 +2801,7 @@ END marks the end of the fn expression"
28012801 (not (clojure--in-string-p)))
28022802 (replace-match sub))))))
28032803
2804- (defun clojure-convert-shorthand-fn ()
2804+ (defun clojure-promote-fn-literal ()
28052805 " Convert a #(...) function into (fn [...] ...), prompting for the argument names."
28062806 (interactive )
28072807 (when-let (beg (clojure-string-start))
@@ -2810,7 +2810,7 @@ END marks the end of the fn expression"
28102810 (ignore-errors (forward-char 1 ))
28112811 (re-search-backward " #(" (save-excursion (beginning-of-defun ) (point )) 'noerror ))
28122812 (let* ((end (save-excursion (clojure-forward-logical-sexp) (point-marker )))
2813- (argspec (clojure--gather-shorthand -args))
2813+ (argspec (clojure--gather-fn-literal -args))
28142814 (arity (car argspec))
28152815 (vararg (cdr argspec)))
28162816 (delete-char 1 )
@@ -2822,14 +2822,14 @@ END marks the end of the fn expression"
28222822 (let ((name (read-string (format " Name of argument %d : " n))))
28232823 (when (/= n 1 ) (insert " " ))
28242824 (insert name)
2825- (clojure--substitute-shorthand -arg n name end)))
2825+ (clojure--substitute-fn-literal -arg n name end)))
28262826 (number-sequence 1 arity))
28272827 (when vararg
28282828 (insert " & " )
28292829 (let ((name (read-string " Name of variadic argument: " )))
28302830 (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!" )))
28332833
28342834; ;; Renaming ns aliases
28352835
0 commit comments