10

I tried to set the foreground color of the cursor face, but it does not seem to work. Setting the background color works fine, but setting the foreground color does not have any effect.

I would like Emacs to act in the same way as my terminal. When I move the cursor over the text the foreground color does not change.

enter image description here

When I do the same in Emacs the foreground color becomes white.

enter image description here

How can I stop Emacs inverting the text at the cursor?

2 Answers 2

6

Nope. M-x customize-option cursor shows you the doc string:

Basic face for the cursor color under X. Hide Currently, only the :background attribute is meaningful; all other attributes are ignored. The cursor foreground color is taken from the background color of the underlying text.

Note the last sentence.

Consider filing an enhancement request: M-x report-emacs-bug.

3
  • 3
    Uff. The inconceivable happened: I found something Emacs can not do. ;-)
    – ceving
    Commented Dec 5, 2015 at 10:12
  • 1
    There are an infinite number of things that the Emacs design or implementation does not immediately support. M-x report-emacs-bug to suggest enhancements.
    – Drew
    Commented Dec 5, 2015 at 16:01
  • 4
    Still not possible?
    – rien333
    Commented Mar 14, 2019 at 17:51
0

A workaround could be to change the cursor shape via the cursor-type, for example:

(setq cursor-type 'hollow)
(setq cursor-type 'bar)
(setq cursor-type 'hbar)

I know, it's a brutal change, but at least the foreground color is preserved.

2
  • I tried customizing cursor-type but it did not change anything to the problem. Could you please elaborate on this workaround?
    – Giuseppe
    Commented Sep 27, 2020 at 8:54
  • By using a hollow cursor type you simply see through it so Emacs won't change the foreground color of the area in the middle.
    – cYrus
    Commented Sep 27, 2020 at 9:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.