13

如果我运行emacs --daemon(in.xinitrc或更高版本)然后emacsclient -c,新创建的框架具有黑色光标颜色,无论 colortheme 或任何其他设置如何。更准确地说,在我输入任何内容之前,光标颜色为白色(或其他颜色),但第一次按键时,它变为黑色,无法通过set-cursor-color. 默认和我的自定义颜色主题都是黑色的,因此编辑非常不舒服。

如果我运行emacsM-x server-start而不是emacs --daemon那么这个问题不会出现。但是这样我需要保留一个emacs“主”框架而不是偶然杀死它,这似乎不是一个好的解决方案。

我有以下块,.emacs.d/init.el但它没有帮助:

(set-cursor-color "red")
(setq initial-frame-alist '((cursor-color . "red")))
(setq default-frame-alist '((cursor-color . "red")))
(add-hook 'window-setup-hook '(lambda () (set-cursor-color "red")))
(add-hook 'after-make-frame-functions '(lambda (f) (with-selected-frame f (set-cursor-color "red"))))

如果我跑步,M-x describe-face RET cursor我会得到:

(...)
Defined in `faces.el'.

        Family: unspecified
       Foundry: unspecified
         Width: unspecified
        Height: unspecified
        Weight: unspecified
         Slant: unspecified
    Foreground: unspecified
    Background: black
     Underline: unspecified
      Overline: unspecified
Strike-through: unspecified
           Box: unspecified
       Inverse: unspecified
       Stipple: unspecified
          Font: unspecified
       Fontset: unspecified
       Inherit: unspecified
4

5 回答 5

7

相信在最近的 Emacsen 中,使用框架属性来设置光标颜色并不是首选的方法。因此,不要使用set-cursor-coloror initial-frame-alist/ default-frame-alist,而是尝试:

(set-face-background 'cursor "red")

也许:

(set-face-attribute 'cursor nil :background "red"`)
于 2011-11-20T20:38:43.037 回答
5

哇哈哈哈!我认为过去 2 年没有人发布解决方案,因为你们都是 EVIL emacs 用户!

说实话,我自己现在正在尝试邪恶模式,我刚刚在我的系统上解决了这个问题。把它放在你的 .emacs 文件中并抽它:

'(evil-default-cursor (quote (t "white")))

我刚刚在 bitbucket 中针对 Evil 存储库打开了一个错误。

对我自己来说,我发现在真正精通 emacs 的 6 年左右之后,多键和弦让我筋疲力尽。Evil-mode 可能会让我再次使用 emacs,这是一件好事。正如Benedict所说(在函数式编程的上下文中),“完成工作通常需要一些邪恶。 ”这似乎也适用于 Emacs。

PS 对于任何人认为这个答案只是DH0或其他不成熟和不合适的答案,Emacs 和 VI 用户之间的主要是开玩笑的争执已经肆虐多年。Emacs 有它自己的 Emacs 教堂,VI 有电子游戏,World War VI。因此,Emacs 最成功的 VI 键绑定端口被命名为 evil-mode(evil 中包含 VI 一词)也就不足为奇了。我喜欢这两个编辑器,并赞扬最终使 VI 键绑定在 emacs 中工作的邪恶开发人员。

于 2013-10-11T14:57:15.710 回答
5

好的..这个问题可以通过添加来解决

(setq default-frame-alist '((cursor-color . "white")))

虽然我不明白为什么以前不是问题。

请参阅论坛主题。

于 2014-12-31T17:39:52.700 回答
1

这对我有用:

(setq evil-default-cursor t) ;; Now evil takes the default cursors 
(set-cursor-color "white") ;; Set it to white
(set-mouse-color "white") ;; Same
于 2014-01-15T11:11:25.230 回答
0

我也有同样的问题,多年来。

就我而言,我这样做:

M-x
set-cursor-color
"white"<ENTER>

这对我有用,但我每次都必须这样做,这sux..

回到我的旧工作场所,我已经解决了这个问题,但我没有以前在旧工作场所拥有的 init.el,现在我需要重新解决这个问题,希望这里有人能在我之前解决这个问题.

于 2013-07-09T01:21:26.990 回答