更改 Emacs 光标颜色/与颜色主题的交互
由于 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
default-frame-alist 值用于创建的新帧。它们不会影响当前帧。如果需要,您可以设置 initial-frame-alist在 .emacs 文件中指定初始帧的值。要仅更改当前帧中的光标颜色,请使用:
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: