I would like to set several face variables for use with any theme in my personal init-file. Is there a hook I could use to insure it is theme independent?

  • I am not sure about a hook that will have the right timing, but would it work for you to simply set the face variables in your init file after the call to load-theme? I have done something similar in the past because some themes would color the fill-column-indicator in a way that made it almost invisible, so I just set it to always be a particular color regardless of theme.
    – elethan
    Jun 1 '16 at 13:24
  • 1
    @elethan that works just fine. I assumed load-theme worked like a mode and required a hook. It make sense, the theme is global between modes and sets all variables when loaded. I was worried about setting an undefined variable, though I was just over thinking it. Could you reenter it in as answer?
    – lookyhooky
    Jun 1 '16 at 13:54
  • Please post the answer yourself - it looks like elethan will not be posting it. And then please accept the posted answer.
    – Drew
    Aug 15 '16 at 1:08
  • Perhaps you would like to submit an enhancement request to add an after-load-them-hook? Use M-x report-emacs-bug to do that.
    – Drew
    Oct 15 '17 at 18:04

There is no after-theme-load-hook. The theme is loaded directly after (load-theme 'theme-name). Simply modify the desired theme variables after the load-theme function call.

  • This is not a satisfactory solution IMO. If you do this interactively in your emacs session, you are going to have to use the advice system to automatically set variables after load-theme is called. Usually, and certainly in this case, the need to use the advice system is evidence of a missing hook.
    – imalison
    Dec 30 '16 at 1:34
  • It seems overboard to define advice around load-theme just to get a few customized fonts. Though I agree, if load theme is called interactively the customizations would be overridden. But I do not change themes often and it has not been an issue.
    – lookyhooky
    Jan 1 '17 at 19:20
  • The missing of a vim like autocmd (I am talking about autocmd ColorScheme *) is really saddening.
    – jdhao
    Oct 14 at 5:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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