41
41
(require 'sgml-mode )
42
42
(require 'inflections )
43
43
(require 'hydra )
44
+ (require 'subword )
44
45
45
46
(defcustom cljr-add-ns-to-blank-clj-files t
46
47
" If t, automatically add a ns form to new .clj files."
@@ -3365,6 +3366,17 @@ See: https://github.com/clojure-emacs/clj-refactor.el/wiki/cljr-create-fn-from-e
3365
3366
(when (string-match " [^/]+$" s)
3366
3367
(substring s (car (match-data )) (car (cdr (match-data ))))))
3367
3368
3369
+ (defun cljr--dashed-words (s )
3370
+ " Take the string S and replace all the word separators with '-'
3371
+ and make the whole string lower-cased."
3372
+ (with-temp-buffer
3373
+ (insert s)
3374
+ (goto-char (point-min ))
3375
+ (while (not (eobp ))
3376
+ (subword-forward)
3377
+ (insert " " ))
3378
+ (mapconcat 'identity (split-string (downcase (buffer-string ))) " -" )))
3379
+
3368
3380
(defun cljr--guess-param-name (form )
3369
3381
(let* ((prepped-form (cljr--strip-off-semantic-noops
3370
3382
(cljr--unwind-s form)))
@@ -3375,11 +3387,11 @@ See: https://github.com/clojure-emacs/clj-refactor.el/wiki/cljr-create-fn-from-e
3375
3387
((cljr--keyword-lookup-p prepped-form)
3376
3388
(cljr--strip-keyword-ns (match-string 1 prepped-form)))
3377
3389
((and fn-call (string-suffix-p " ." fn-call))
3378
- (s -dashed-words (car (last (split-string fn-call " \\ ." t )))))
3390
+ (cljr- -dashed-words (car (last (split-string fn-call " \\ ." t )))))
3379
3391
((and fn-call (string-prefix-p " create-" fn-call))
3380
3392
(string-remove-prefix " create-" fn-call))
3381
3393
((and fn-call (string-prefix-p " .get" fn-call))
3382
- (s -dashed-words (string-remove-prefix " .get" fn-call)))
3394
+ (cljr- -dashed-words (string-remove-prefix " .get" fn-call)))
3383
3395
((string= " get-in" fn-call)
3384
3396
(cljr--find-param-name-from-get-in prepped-form))
3385
3397
((string= " get" fn-call)
0 commit comments