How to treat my custom emacs theme as a "safe theme"?

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)

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)