更改 Emacs 光标颜色/与颜色主题的交互

发布于 2024-11-24 04:23:49 字数 1182 浏览 0 评论 0原文

由于 Cocoa Emacs 中的这个错误,使用框光标会遮挡光标下方的字符,并且使用带曝光的条形光标往往使我无法分辨它在文本海洋中的位置。所以我想让光标成为一个红色条。我认为这在我的 .emacs 中会起作用:

(when window-system
  (require 'color-theme-solarized)
  (global-set-key (kbd "C-c l") 'color-theme-solarized))
(case window-system
  ('ns (progn
        (defadvice color-theme-solarized (after cursor-more-visible)
          "change the cursor color so it stands out more"
          (set-cursor-color "red"))
        (ad-activate 'color-theme-solarized)
        (color-theme-solarized 'dark)
        [...]
        ))
  [...])

但是以编程方式调用 color-theme-solarized 实际上不会更改光标颜色。如果我以交互方式调用 color-theme-solarized(或在 *scratch* 缓冲区中使用 C-xC-e),光标颜色确实会改变——所以这个建议在某种程度上被采纳了。

添加 (setq default-frame-alist '((cursor-color . "red"))) (按照建议 here)似乎没有帮助。只是为了好玩,我尝试将 (color-theme-solarized 'dark) 更改为 (call-interactively color-theme-solarized),但没有成功。

如何让光标颜色在启动时自动设置为红色?

Because of this bug in Cocoa Emacs using the box cursor obscure the character beneath the cursor, and using the bar cursor with solarized has tended to make me not be able to tell where it is in a sea of text. So I want to have the cursor be a red bar. I thought this would work, in my .emacs:

(when window-system
  (require 'color-theme-solarized)
  (global-set-key (kbd "C-c l") 'color-theme-solarized))
(case window-system
  ('ns (progn
        (defadvice color-theme-solarized (after cursor-more-visible)
          "change the cursor color so it stands out more"
          (set-cursor-color "red"))
        (ad-activate 'color-theme-solarized)
        (color-theme-solarized 'dark)
        [...]
        ))
  [...])

But the programmatic invocation of color-theme-solarized actually does not change the cursor color. The cursor color does change if I invoke color-theme-solarized interactively (or in the *scratch* buffer with C-xC-e)—so the advice is being taken, sort of.

Adding a (setq default-frame-alist '((cursor-color . "red"))) (as suggested here) doesn't seem to help. Just for kicks I tried changing (color-theme-solarized 'dark) to (call-interactively color-theme-solarized), with no success.

How can I get the cursor color to be automatically set to red at startup?

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

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

发布评论

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

评论(1

梦里寻她 2024-12-01 04:23:49

default-frame-alist 值用于创建的新帧。它们不会影响当前帧。如果需要,您可以设置 initial-frame-alist在 .emacs 文件中指定初始帧的值。要仅更改当前帧中的光标颜色,请使用:

(set-cursor-color "red")

The default-frame-alist values are used for NEW frames that are created. They don't affect the current frame. You can set initial-frame-alist if you want to specify the initial frame's values in your .emacs file. To change just the cursor color in the current frame, use:

(set-cursor-color "red")
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文