11

I set my theme with load-theme in a use-package macro loaded at startup. The theme has also been installed with use-package, from the repository.

At each start emacs asks me if I really want to load the theme in case it's not safe, how can I tell him to stop ?

  • It should also ask you if you want to have your choice remembered by emacs for future sessions, but it sounds like it does not ask you this, am I right? If it is not, I am not sure why. Try using `M-x load-theme` and selecting the theme you want to use, and see if it offers you the option to recognize it is safe in the future. I just tried installing a new theme and loading it this way, and it worked for me. The hash of the theme needs to be added to `custom-safe-themes` but I am not sure how to do this manually - probably you shouldn't. – elethan Dec 17 '15 at 20:39
  • 3
    If all else fails, you could add `(setq custom-safe-themes t)` to your init file before you load your theme. This will treat all themes as safe, which could be a risk in theory, but if you are only installing themes from trusted sources, I don't see any issue – elethan Dec 17 '15 at 20:50
  • When I `M-x load-theme` emacs doesn't ask me like if it is safe yet, but when I load it from a .el file at startup it still asks me if I want to run lisp code. `(setq custom-safe-themes t)` works for me so I'll test new themes in a session before loading them. Thanks – Nicolas Scotto Di Perto Dec 17 '15 at 22:09

1 Answers1

24

Set the second argument of the load-theme function. From its docstring:

If the theme is not considered safe by ‘custom-safe-themes’, prompt the user for confirmation before loading it. But if optional arg NO-CONFIRM is non-nil, load the theme without prompting.

For example:

(load-theme 'solarized-dark t)

will load the solarized-dark theme without asking.

undostres
  • 1,793
  • 12
  • 15