无法在emacsclient中更改光标颜色

mod*_*lar 13 emacs emacs-faces

如果我运行emacs --daemon(在.xinitrc或之后)然后emacsclient -c,新创建的帧具有黑色光标颜色,无论是colortheme还是任何其他设置.更确切地说,在我输入任何内容之前,光标颜色是白色(或其他颜色),但是第一个按键时它变为黑色并且无法通过改变set-cursor-color.默认和我的自定义colorthemes都是黑色,所以它使编辑非常不舒服.

如果我跑emacs,M-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"))))
Run Code Online (Sandbox Code Playgroud)

如果我跑,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
Run Code Online (Sandbox Code Playgroud)

san*_*inc 7

我相信在最近的Emacsen中,使用frame属性设置光标颜色不是首选方法.所以不要使用set-cursor-colorinitial-frame-alist/ default-frame-alist,请尝试:

(set-face-background 'cursor "red")
Run Code Online (Sandbox Code Playgroud)

也许:

(set-face-attribute 'cursor nil :background "red"`)
Run Code Online (Sandbox Code Playgroud)


djh*_*987 6

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

(setq default-frame-alist '((cursor-color . "white")))
Run Code Online (Sandbox Code Playgroud)

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

看到这个论坛帖子.


Gle*_*son 5

Bwahahaha!我认为没有人在过去两年中发布过一个解决方案,因为你们都是EVIL emacs用户!

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

'(evil-default-cursor (quote (t "white")))
Run Code Online (Sandbox Code Playgroud)

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

对于我自己来说,我发现在大约6年左右的时间里,它已经真正精通emacs,多键的和弦对我的肌腱很难.邪恶模式可能允许我再次使用emacs,这是一件好事.正如Benedict所说(在功能编程的背景下)," 通常需要一些邪恶来完成工作. "似乎也可能适用于Emacs.

PS对于任何人来说,感觉这个答案只是DH0或其他不成熟和不恰当的,Emacs和VI用户之间的争吵已经持续了多年.Emacs拥有自己的Emacs教堂,VI有视频游戏,第六次世界大战.因此,对Emacs最成功的VI键绑定端口被命名为邪恶模式(邪恶中有VI这个词)也就不足为奇了.我喜欢这两位编辑并且赞扬那些最终使得VI键绑定在emacs中工作的邪恶开发者.