Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

setting the emacs theme on startup without the interactive mode

Tags:

emacs

elisp

I am using the following snippet to set the theme on Emacs startup.

(load-theme 'sanityinc-tomorrow-eighties)

However it also asks me for confirmation that this will load some lisp code, how do I turn off this confirmation?

like image 579
murtaza52 Avatar asked Apr 10 '14 02:04

murtaza52


1 Answers

Use load-theme with a non-nil NOCONFIRM arg.

C-h f load-theme tells you that (load-theme 'sanityinc-tomorrow-eighties t) should load the theme without asking for confirmation:

,----
| load-theme is an interactive compiled Lisp function in `custom.el'.
| 
| (load-theme THEME &optional NO-CONFIRM NO-ENABLE)
| 
| Load Custom theme named THEME from its file.
| The theme file is named THEME-theme.el, in one of the directories
| specified by `custom-theme-load-path'.
| 
| 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.
| 
| Normally, this function also enables THEME.  If optional arg
| NO-ENABLE is non-nil, load the theme but don't enable it, unless
| the theme was already enabled.
| 
| This function is normally called through Customize when setting
| `custom-enabled-themes'.  If used directly in your init file, it
| should be called with a non-nil NO-CONFIRM argument, or after
| `custom-safe-themes' has been loaded.
| 
| Return t if THEME was successfully loaded, nil otherwise.
`----

You should learn to ask Emacs first. C-h f is the least you should know and use, before asking something so simple here.

like image 170
Drew Avatar answered Oct 17 '22 03:10

Drew