-
Notifications
You must be signed in to change notification settings - Fork 24
Open
Labels
Description
Hi:
I have seen the code and I wanted to simplify it a little bit the user customization. If you find it is useful you are free to modify it and use in the package's code:
(defcustom tests '(string-inflection-word-p
string-inflection-underscore-p
string-inflection-upcase-p
string-inflection-pascal-case-p
string-inflection-camelcase-p
string-inflection-kebab-case-p
))
(defcustom funcs [
string-inflection-upcase-function
string-inflection-upcase-function
string-inflection-pascal-case-function
string-inflection-camelcase-function
string-inflection-kebab-case-function
string-inflection-capital-underscore-function
string-inflection-underscore-function
])
(defun string-inflection-all-cycle-function (var)
(interactive)
(let ((temp tests)
(it 0))
(while temp
(if (funcall (car temp) var)
(progn
(funcall (aref funcs it) var)
(setq temp nil))
(setq it (1+ it))
(setq temp (cdr temp))
(unless temp
(funcall (aref funcs it) var))))))
This code has 2 main advantages:
- It is simpler to add/modify the functions in the cycle or their order
- It is trivial to modify this code to implement a reverse order function.