Emacs 防止提示将要加载的主题视为未来会话的安全主题

Emacs 防止提示将要加载的主题视为未来会话的安全主题,emacs,themes,Emacs,Themes,我在emacsinit.el中使用了以下主题 (require 'color-theme-sanityinc-tomorrow) (color-theme-sanityinc-tomorrow-day) 但是,每次Emacs启动时,它都会问我“加载主题可以运行Lips代码。真的加载吗?”,然后它会问“将此主题视为未来会话的安全主题吗?” 我需要做什么才能将其视为是加班。我确信这可以在Emacs中定制,但我对编辑器和lisp还是比较陌生的 感谢您的帮助。解决方法如下 ;;; Treat all

我在emacs
init.el中使用了以下主题

(require 'color-theme-sanityinc-tomorrow)
(color-theme-sanityinc-tomorrow-day)
但是,每次Emacs启动时,它都会问我“
加载主题可以运行Lips代码。真的加载吗?
”,然后它会问“
将此主题视为未来会话的安全主题吗?

我需要做什么才能将其视为是加班。我确信这可以在Emacs中定制,但我对编辑器和lisp还是比较陌生的

感谢您的帮助。

解决方法如下

;;; Treat all themes as safe
(setq custom-safe-themes t)
注意:请在加载主题之前放置此项。

解决方法如下

;;; Treat all themes as safe
(setq custom-safe-themes t)

注意:请在加载主题之前放置此选项。

另一个选项是使用可选的NO-CONFIRM开关加载主题,如下所示:

(load-theme 'color-theme-sanityinc-tomorrow-day t nil)
加载主题的说明如下所示:

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.

另一个选项是使用可选的NO-CONFIRM开关加载主题,如下所示:

(load-theme 'color-theme-sanityinc-tomorrow-day t nil)
加载主题的说明如下所示:

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.