Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I defined a function in my .emacs file, and I want to call it when a major mode is loaded. My function is interactive.

If I invoke my function by M-x, everything seems alright. But if I invoke my function from the mode hook, I got below error:

File mode specification error: (void-variable set-color-theme)

But actually, the function has been invoked correctly. So, I do not understand why it reports the variable is void.

share|improve this question
2  
(Show your code!) For example, it looks like this: (add-hook 'rmail-show-message-hook 'turn-on-visual-line-mode) Make sure your function (turn-on-visual-line-mode in the example) is defined above the line where you try to make your hook. –  Emanuel Berg Sep 2 '12 at 5:37
    
@EmanuelBerg thanks, moving the code works :) –  davidshen84 Sep 2 '12 at 14:02

1 Answer 1

up vote 0 down vote accepted

@EmanuelBerg thanks, moving the code works :)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.