tags:

views:

168

answers:

2

I'm using emacs 22.3.3 over X on a Windows box. When I've switched to another window, the cursor stays enabled (which means if it's blinking, it still blinks).

Every other program I've ever used disables the cursor when the window doesn't have focus. Since emacs is different, I keep accidentally typing input meant for emacs into other programs.

How can I programatically disable the cursor in my .emacs file when the window loses focus?

I know that emacs has a disabled cursor mode, because it switches the cursor to white with a black border when a particular buffer doesn't have the focus.

Update: My X client is Xming 6.9.0.31. I'm using X forwarding through putty.

A: 

The white with a black buffer is what I get when the Emacs window doesn't have focus. I'm using GNU Emacs 22.1.1 on XP. I haven't tried 22.3.3 yet, but I'd guess the issue might be that it is over X, rather than the version.

Some more info might be nice. What platform is the emacs itself running on? What version of X client are you using?

T.E.D.
Updated w/ more info. You might be right. It works correctly when emacs is in the foreground of a terminal window.
Drew Hoskins
+2  A: 

Sounds like it's a window manager issue... the window manager is sending events to Emacs when (you believe) it shouldn't.

GNU Emacs doesn't have a window(frame) leave event hook (I've looked and can't find one (as of 23.1)), and the question: how to automatically save files on lose focus in emacs appears to bear that out.

Good luck...

Trey Jackson
Or perhaps it's not sending emacs a lose focus message like it should be. I'll try investigating on the X client side.
Drew Hoskins