简体   繁体   中英

setting the emacs theme on startup without the interactive mode

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?

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

Ch 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 . Ch f is the least you should know and use, before asking something so simple here.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM