I want to call clone-indirect-buffer
or clone-indirect-buffer-other-window
within a function dependent on the prefix. To do this, I assign the appropriate clone function to a variable using let. However, when I try to abstract the name of the buffer I get a type error.
This simplified example works as expected, creating a buffer called "banana":
(let* ((fun #'clone-indirect-buffer)
(buf (apply fun '("banana" nil))))
(switch-to-buffer buf)) ; #<buffer banana>
When I move the name "banana" into a variable, I get a type error:
(let* ((name "banana")
(fun #'clone-indirect-buffer)
(buf (apply fun '(name nil))))
(switch-to-buffer buf))
;; (wrong-type-argument stringp name)
I notice that quasi-quote produces the expected result:
(let* ((name "banana")
(fun #'clone-indirect-buffer)
(buf (apply fun `(,name nil))))
(switch-to-buffer buf)) ; #<buffer banana>
AFAICT, name is a string. So, why the error?