Newbie Emacs tip: In Emacs Lisp, to print a message to the *Messages* buffer, use the message function:
(message "hello")
To print an arbitrary value of a variable to the current buffer as the text of an elisp expression, such as for debugging, use the pp function:
(pp some-var)