简体   繁体   English

Emacs 24客户端无法正确加载颜色主题

[英]Emacs 24 client not loading color theme properly

I want to use the color theme solarized-light. 我想使用日光型彩色主题。 It works just fine if I do (load-theme 'solarized-light t) , however I am having issues with having it load automatically. 如果我这样做的话,它的工作就很好了(load-theme 'solarized-light t) ,但是我在自动加载时遇到了问题。

If I simply add (load-theme 'solarized-light t) to my .emacs, the color theme won't load properly. 如果仅在.emacs中添加(load-theme 'solarized-light t) ,则无法正确加载颜色主题。 Some of the colors are applied but others aren't, I assume this is because it's not running in a GUI so it assumes the terminal can't support the colors or something. 应用了某些颜色,但未应用其他颜色,我认为这是因为它没有在GUI中运行,因此它假定终端不支持这些颜色或其他颜色。

Logically, I tried putting the call to load the theme in the after-make-frame-functions variable. 从逻辑上讲,我尝试将调用以将主题加载到after-make-frame-functions变量中。 I thought that if it only tries to load the theme after I'm already in a GUI, then it should work right? 我认为,如果仅在我已经在GUI中后才尝试加载主题,那么它应该工作正常吗?

It doesn't. 没有。 When I create the first frame the same thing happens with the terminal and the colors aren't loaded properly. 当我创建第一帧时,终端也会发生同样的事情,并且颜色无法正确加载。 However, if I make another frame while I already have one open then it works properly. 但是,如果在已经打开一个框架的情况下制作另一个框架,则它可以正常工作。

Is there any way to apply the theme properly when I make the first frame, or even before that if possible? 在制作第一帧时,是否有可能适当地应用主题?

I'm on Arch Linux running Emacs 24.3.1 as a daemon . 我在运行Emacs 24.3.1作为守护程序的 Arch Linux上。 In case this behavior is tied to the window manager, I've tried it in both StumpWM and Openbox and it doesn't work in either. 如果这种行为与窗口管理器相关联,我已经在StumpWM和Openbox中都尝试过了,但在这两者中均不起作用。

Edit : 编辑

As a temporary workaround I have made a command in my .stumpwmrc that runs the shell command emacsclient --eval "(load-theme 'solarized-light t)" after making the frame. 作为临时的解决方法,我在.stumpwmrc中创建了一个命令,该命令在制作框架后运行shell命令emacsclient --eval "(load-theme 'solarized-light t)" This works but it doesn't answer my original question (nor is it likely to help people with other window managers). 这行得通,但不能回答我最初的问题(也无法帮助其他窗口管理器的人)。

add

(package-initialize)
(setq package-enable-at-startup nil)

to the top of your .emacs file. .emacs文件的顶部。 then set the them from Mx customize-groups: themes, select theme in the menu and save to your .emacs file, also disable foreground and background from default faces group. 然后从Mx custom-groups:主题中设置它们,在菜单中选择主题并保存到.emacs文件,还从默认面孔组禁用前景和背景。 restart emacs or Mx eval-buffers to check. 重新启动emacs或Mx eval缓冲区进行检查。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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