I'm trying to add a function I created to a hook, but the obvious (to my Schemer mind) way doesn't seem to work. The function is used in 2 places and I want to keep my code DRY so no anonymous function. Though I could wrap my function in a lambda, there must be a better way.
Doesn't work:
(defun my-function ()
;; do my stuff)
(add-hook 'some-hook-list my-function)
I get the error message:
Symbol's value as variable is void: my-function
I figured it out. It's pretty simple. Just quote the function:
Fixed code: (defun my-function () ;; do my stuff)
(add-hook 'some-hook-list 'my-function) ;;; There's a quote before my-function
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With