无法将颜色主题应用于 Emacs 中的一帧?
我的 .emacs
文件位于此处。我希望当我处于 shell 模式
时主题能够改变。但所发生的情况是该主题被应用到所有窗口。我将变量 color-theme-is-global 设置为 nil,但问题仍然存在。
(add-hook 'shell-mode-hook 'color-theme-monokai-terminal)
(set-variable 'color-theme-is-global nil)
这些是我的 .emacs 文件中的相应行。我应该做什么才能让它发挥作用?
My .emacs
file is here. I want the theme to change when I am in shell-mode
. But what happens is that the theme gets applied to all the windows. I set the variable color-theme-is-global
to nil
, but the problem still persists.
(add-hook 'shell-mode-hook 'color-theme-monokai-terminal)
(set-variable 'color-theme-is-global nil)
These are the corresponding lines in my .emacs
file. What should I do to make it work?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我通常将 Emacs 作为守护进程启动,然后根据需要打开框架。我对 X 框架和终端框架使用不同的颜色主题,如下所示:
您可以将
(if window-system ...)
部分替换为检查 shell-script-mode 和 color-theme- X 部分包含您最喜欢的主题。这样做有一个缺点:如果您不将 Emacs 作为守护进程启动,则自定义只会在您创建第二个框架后启动,弹出的第一个框架将具有标准主题。
I usually start Emacs as a daemon and then open frames as needed. I use different color themes for X frames and terminal frames like so:
You can replace the
(if window-system ...)
part with your check for shell-script-mode and the color-theme-X parts with your favorite themes.There is one downside to this: if you don't start Emacs as a deamon, the customization will only kick in after you create a second frame, the first one that pops up will have the standard theme.
我认为你的术语是错误的:在 emacs-speak 中,
frame
意味着人们通常在图形环境中所说的window
。 (也就是说,具有关闭、最小化和最大化按钮以及标题栏等的东西是“框架”。)而当您执行Cx 3
(拆分- window)被称为windows
,当你执行诸如Mx shell-mode
之类的操作时,你会得到一个新的缓冲区
,它可能位于也可能不位于一个新窗口。颜色主题始终是框架全局的(据我所知,这当然也是文档所建议的)变量
color-theme-is-global
确定单个主题是否跨框架传播 /em>.我认为最接近您想要的东西是这样的(完全未经测试,可能已损坏):
尽管这确实创建了一个新框架,但这不是您想要的。
I think your terminology is off: in emacs-speak
frame
means what people normally mean bywindow
in a graphical environment. (That is, the thing that has the close, minimize and maximize buttons and a titlebar, etc, is the "frame".) Whereas the things that show up when you do aC-x 3
(split-window) are calledwindows
, and when you do something likeM-x shell-mode
you get a newbuffer
, which may or may not be in a new window.Color themes are always frame-global (as far as I know, and it's certainly what the documentation suggests) the variable
color-theme-is-global
determines whether a single theme propagates across frames.I'm thinking that the closest thing to what you want is something like (completely untested, probably broken):
Although this does create a new frame, which isn't what you want.