I have a buffer with this line of text:
This is a random test
I want to convert test
in T.E.S.T.
, like this:
This is a random T.E.S.T.
So far, I came up with this function:
(defun mu-convert-to-acronym (string)
"Convert the given STRING in an acronym.
An acronym must be uppercase and have each letter followed by a dot."
(s-upcase
(s-append "."
(s-join "."
(delete ""
(s-split "" string))))))
My question is: how can I turn this function into a command I can call interactively?
I'd like the command to behave like capitalize-word
and upcase-word
, meaning I don't need to select the word I need to convert but I can just issue the command on the word next to point or, given a negative prefix, the one before point.