Consider the following example:
(defun glue (str1 str2)
(format "%s%s" str1 str2))
(setq str1 "Hello, ")
(setq str2 "World!")
(insert (glue str1 str2))
This inserts Hello, World!
into a buffer.
I want to let the user define the format set in (format "%s%s" str1 str2)
.
For example:
(defun glue (str1 str2)
(format "%s%s" hw))
(setq str1 "Hello, ")
(setq str2 "World!")
(insert (hw))
(setq hw (str2 str1))
This should return World!Hello,
However this returns Symbol’s function definition is void: hw
How can I set hw
so it can be passed to (format "%s%s" hw)
?
Not enough arguments for format string
: the first error I get when evaluating the second block of code is on(insert (hw))
which says:(void-function hw)
which makes sense since there is no function namedhw
. That leads me to believe that you typed in something other than what you tested. Please check and edit the question so that it corresponds with what you tested.