我可以调整每种模式的颜色主题吗?

发布于 2024-10-31 06:33:11 字数 753 浏览 0 评论 0原文

我使用的是 Ubuntu 11.04 中的 Emacs 23.2.1。我已经安装了 purcell 的 Solarized 颜色主题端口,但我想调整一些使我的 Python 缓冲区看起来更像Solarized Vim 屏幕截图。编辑颜色主题非常容易,以便始终使用我喜欢的颜色,但这也会在 C 模式下更改它们,我想避免这种情况。

具体来说,这是builtin-face的默认设置:

(font-lock-builtin-face ((t (:foreground ,green))))

在Python模式下 - 并且仅在Python模式下 - 我想使用它:

(font-lock-builtin-face ((t (:foreground ,blue))))

我理想地希望通过将一些逻辑修补到颜色主题定义中来进行此更改,以便我可以将我的调整发送到上游,并附上注释“这仅改变了 Python 突出显示”。如果做不到这一点,我会在我的 init.el 中解决一些问题。不过,我更愿意将它与主要颜色主题一起打包。

这可能吗?刮掉那个。这是 Emacs;我知道这是可能的!但我该怎么办呢?

I'm using Emacs 23.2.1 from Ubuntu 11.04. I've installed purcell's port of the Solarized color-theme, but I'd like to adjust some of the faces to make my Python buffers look more like the Solarized Vim screenshot. It's easy enough to edit the color-theme so that my preferred colors are always used, but that would also change them in C mode and I want to avoid that.

Specifically, here's the default setting for the builtin-face:

(font-lock-builtin-face ((t (:foreground ,green))))

In Python mode - and only Python mode - I'd like to use this instead:

(font-lock-builtin-face ((t (:foreground ,blue))))

I'd ideally like to make this change by patching some logic into the color-theme definition so that I can send my adjustments upstream with a note saying "this changes just the Python highlighting". Failing that, I'd settle for something in my init.el. I'd much rather have it packaged with the main color-theme, though.

Is this possible? Scratch that. This is Emacs; I know it's possible! But how can I do it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

£噩梦荏苒 2024-11-07 06:33:11

使用面部重映射应该可以实现这一点。即使您更喜欢修补颜色主题定义,我还是建议将类似以下几行的内容放入您的 init.el 文件中,因为这是一种更“标准”的方式事物:

(add-hook 'python-mode-hook 'remap-builtin-face-blue)

(defun remap-builtin-face-blue ()
  (let ((blue "#2075c7"))
    (set (make-local-variable 'face-remapping-alist)
         `((font-lock-builtin-face :foreground ,blue)))))

This should be possible using Face Remapping. Even though you prefer to patch up the color-theme definition, I'd argue for putting something like the following lines into your init.el file, as it is a more "standard" way of doing such things:

(add-hook 'python-mode-hook 'remap-builtin-face-blue)

(defun remap-builtin-face-blue ()
  (let ((blue "#2075c7"))
    (set (make-local-variable 'face-remapping-alist)
         `((font-lock-builtin-face :foreground ,blue)))))
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文