I am learning how to program in emacs lisp. I thought I would write a simple function that prints a function definition to the messages buffer. This works fine:
(let (
(fDefAsString (symbol-function 'scroll-down))
)
(message "%s" fDefAsString)
(switch-to-buffer-other-frame "*Messages*"))
but I wanted this to be a function that could take an argument, the argument being the name of the function whose definition I want to see. So I tried this:
(defun message-function-definition (nameOfFunction)
(let (
(fDefAsString (symbol-function 'nameOfFunction))
)
(message "%s" fDefAsString)
(switch-to-buffer-other-frame "*Messages*")))
and then I wrote this:
(message-function-definition 'scroll-down)
Then I ran "eval-buffer".
I keep getting this error:
Debugger entered--Lisp error: (void-function nameOfFunction) symbol-function(nameOfFunction) (let ((fDefAsString ...)) (message "%s" fDefAsString) (switch-to-buffer-other-frame "Messages")) message-function-definition(scroll-down) eval((message-function-definition (quote scroll-down))) eval-last-sexp-1(nil) eval-last-sexp(nil) call-interactively(eval-last-sexp nil nil) recursive-edit() byte-code("\306 @\307=\203!
I've tried quoting, unquoting, and I've tried to use "nameOfFunction" but I can not get this to work. What am I doing wrong?