How do I pass a function as a parameter to in elisp?
First, I'm not sure that naming your function t
is helping as 't' is used as the truth value in lisp.
That said, the following code works for me:
(defun test-func-1 () "test-func-1"
(interactive "*")
(insert-string "testing callers"))
(defun func-caller (callee)
"Execute callee"
(funcall callee))
(func-caller 'test-func-1)
Please note the use of 'funcall', which triggers the actual function call.
The note towards the end of "§13.7 Anonymous Functions" in the Emacs Lisp manual says that you can quote functions with #'
instead of '
to signal to the byte compiler that the symbol always names a function.