【发布时间】:2015-02-12 16:11:14
【问题描述】:
我正在尝试让 Emacs (v24.3.1) 在创建的框架中加载新的自定义主题。也就是说,我的初始帧中有我的默认主题,所有后续帧都应该有一个单独的主题(让我可以轻松识别初始帧)。
这是我目前所拥有的:
;make new frames use a different custom theme
(defun apply-custom-theme (frame)
"Apply custom theme to a frame based on whether its a 'real'
window or a console window."
(select-frame frame)
(if (window-system frame)
(load-theme 'light-blue t)
(load-theme 'tango-black t)))
(add-hook 'after-make-frame-functions 'apply-custom-theme)
这可行,除了加载的主题会影响所有帧,包括初始帧。 [我知道即使没有我的钩子,一帧中的“加载主题”也会影响所有帧。]
我知道我可以使用旧的颜色主题工具来实现这个目标......我很想知道它是否也可以使用 Emacs 24x 自定义主题来完成(这将允许轻松创建和自定义新主题,其中其他东西)。
【问题讨论】:
-
这对你的问题没有帮助,但你可以用
(load-theme (if (window-system frame) 'light-blue 'tango-black) t)缩短你的代码。 -
不幸的是,如果您在守护程序模式下运行 emacs 并且希望为您的 GUI 设置主题而不是为您的终端设置主题,那么这将成为一个真正的问题。即使我遇到了这个问题,然后放弃了。另一种方法是启动 emacs 守护程序并以反向视频模式启动 emacsclient,但 emacs 客户端没有标志。