3

mode is here : http://emacswiki.org/emacs/AutoComplete

and in the bottom:

I have a black background and when I use auto-complete, as soon as I type something my cursor turns black, so now I can’t see it. Help! How am I going to fix this problem?

Ok nevermind, fixed it. Just added (set-cursor-color “white”) to my .emacs file after loading the auto-complete package.

So I just made it too. even (set-cursor-color “#ffffff”) but it doesn't help me. How can I solve this problem?

Correction: it works for emacs but doesn't work for emacsclient

Maybe I must to add some hook? But I need to make a proper hook then, not to add all my mess where I'm trying to solve the trouble setting everything foreground light background dark...

also here is off-topic question: why most of professional emacs users use light themes?

config:

(require 'auto-complete-config)
(ac-config-default)
(set-face-background 'ac-completion-face "darkgray")
(set-face-underline 'ac-completion-face "lightgray")
(set-face-background 'ac-yasnippet-candidate-face "black")
(set-face-underline 'ac-yasnippet-candidate-face "sandybrown")
(set-face-background 'ac-candidate-face "darkgray")
(set-face-underline 'ac-candidate-face "lightgray")
(set-face-background 'ac-selection-face "steelblue")
(set-cursor-color "#ffffff")

(provide 'auto-complete-settings)

Answers for comments:

(frame-parameter (selected-frame) 'cursor-color)
"black"

-- before autocomplete (when cursor light) and after when cursor goes dark.

cnd
  • 32,616
  • 62
  • 183
  • 313
  • 1
    Been using Emacs since 1999 with a dark background and light foreground. – Noufal Ibrahim Apr 17 '12 at 11:39
  • I do not use theme, here is color settings : https://github.com/NeNSha/Aishite/blob/master/site-lisp/init.el – cnd Apr 24 '12 at 03:42
  • 1
    What is the value of `(frame-parameter (selected-frame) 'cursor-color)` in the frame that you have a problem in? Also, can you get the value of that expression *after* it turns to black as well as the value of `ac-cursor-color` both before and after? Thanks. – Tikhon Jelvis Apr 24 '12 at 05:22
  • Coincidentally, I use a dark theme as well (it happens to be blue). What's more interesting is that the default theme for me is dark gray with orange comments (e.g. what I get with `emacs -q`). I have no idea why... – Tikhon Jelvis Apr 24 '12 at 05:26
  • "black" before and after – cnd Apr 24 '12 at 05:30
  • Which version of Emacs are you running? – phils Apr 24 '12 at 08:12

4 Answers4

3

The three faces which autocomplete uses are ac-candidate-face, ac-completion-face and ac-selection-face. Customising them should take care of your problem.

Noufal Ibrahim
  • 71,383
  • 13
  • 135
  • 169
1

I'm not using autocomplete, but I can't reproduce this behaviour for the default face.

In 23.1.1 I can set the background colour of the default face using the same function you've specified, and it applies the change and sets it as the default value for all subsequent frames, including those from emacsclients.

Can you confirm that you're definitely talking to a server to which your changes have been made?

phils
  • 71,335
  • 11
  • 153
  • 198
  • I think the problem is that my parameters are enabled (somehow) for server only and they don't enables to emacslient. I restart server when make changes. – cnd Apr 24 '12 at 09:00
  • As a sanity-check, can you confirm that after you stop the server, you cannot run emacsclient? (obviously omitting the `-a` argument for this test). – phils Apr 24 '12 at 10:02
  • I can't run emacs client with no server, sure – cnd Apr 24 '12 at 10:11
  • Right, I mis-read the question. I was testing the `set-face-*` functions, but only the `set-cursor-color` line was relevant in that code, and *that* one is specific to the selected frame. – phils Apr 24 '12 at 10:19
1

Here is what works for me:

(defun frame-bg (frame)
  "Custom behaviours for new frames."
  (with-selected-frame frame
    (set-cursor-color "#ffffff")
    ))
(frame-bg (selected-frame))
(add-hook 'after-make-frame-functions 'frame-bg)
cnd
  • 32,616
  • 62
  • 183
  • 313
  • 1
    I think you should just add those settings to the `default-frame-alist`. It's possible that currently, they're set only in the `initial-frame-alist`. – Noufal Ibrahim Apr 24 '12 at 09:26
  • This was addressed in an earlier question you posted - http://stackoverflow.com/questions/9271930/how-to-set-emacsclient-background-as-emacs-background – Noufal Ibrahim Apr 24 '12 at 09:28
0

I agree that Heather's answer will work, but I found that all I needed to solve this problem was to put the following into my .emacs file (after enabling auto-complete-mode):

 (set-cursor-color “white”)
Nick Loadholtes
  • 188
  • 1
  • 12