45
votes

I'm using emacs 24 and solarized color theme.

When Emacs starts up, it prompt me with "Loading a theme can run Lisp code, really load?".

When I answer with "yes", it continues to "Treat this theme as safe in future sessions?".

If I say "y", the theme gets loaded, and

(custom-set-variables
    (custome-safe-themes (quote ("..." default))))

gets added to ~/.emacs automatically.

However, those questions come back every time I open Emacs!

What's the proper way to turn those off?

4
Is "..." really the string that gets written to your .emacs? - pmr
@pmr no, it's too long to type, it's some random alphanumerical string, I'm guessing it's a hashed result of some kind. - Daniel Duan
@DaNmarner If you answer the question a second time, are the strings different? - pmr
@pmr Just tried out...yes. That does explain it. But why? I didn't change the theme. - Daniel Duan
You may have a bug on your hands here. Try with other themes and then you might take it to the mailing-lists. Anyway, if you are new to emacs you might want to start with emacs23. I have a configuration that features zenburn/solarized in my github. github.com/bo0ts/.emacs - pmr

4 Answers

90
votes

If you use M-x customize-themes to set and save your preferred theme, then everything should work nicely.

If, instead, you've added code to your .emacs to enable the theme, but that code appears earlier in the file than the custom-set-variables command, then that might be the problem.

You can force Emacs to load a theme without prompting you to confirm its safety by using the load-theme function's NO-CONFIRM flag:

(load-theme 'solarized-light t)
5
votes

the same problem happened here. I solved this issue putting the custom-set-variables code before a load the theme.

(custom-set-variables
 '(custom-safe-themes (quote ("9527feeeec43970b1d725bdc04e97eb2b03b15be982ac50089ad223d3c6f2920" default))))
(custom-set-faces
)

Then I load my theme:

(defun use-default-theme()
  (load-theme 'default-black))

(use-default-theme)
0
votes

I had the same problem and i just removed the lines in .emacs and lo and behold the whole thing worked.

0
votes

After answering yes to those questions and starting emacs, remove or comment the lines containing the load-theme sentence. In my case those were:

(use-package doom-themes :ensure t :config (load-theme 'doom-acario-dark))

If you don´t do that, emacs will ask again if you want to load the theme (which is already a safe one).