Showing posts with label emacs. Show all posts
Showing posts with label emacs. Show all posts

Monday, April 8, 2013

Emacs keyboard delay when switching frame focus

I recently ran into an annoying issue with Emacs; I'm not sure what initiated this problem, but it might be that the default value of focus-follows-mouse changed. Or Ubuntu changed.

Here's the issue that I was seeing:

  • I have multiple Emacs frames, and I like to switch between them often.
  • Switching between them by using Alt-Tab, or clicking, would result in no problems.
  • However, using the interactive function other-frame (via a keybinding) results in a problem that there's an approximately 2 second delay from switching focus to when the keyboard would accept input again. Even worse, Emacs seems to have forgotten what modifier keys I had down, so when it did accept keyboard input, it wouldn't know that I still had the control key held down.
I tried various ways of debugging this to see if anything was going on (xev, strace) but ultimately I figured it out by reading M-x describe-function other-frame. That reveals the following text:


To make this command work properly, you must tell Emacs
how the system (or the window manager) generally handles
focus-switching between windows.  If moving the mouse onto a window
selects it (gives it focus), set `focus-follows-mouse' to t.
Otherwise, that variable should be nil.

When I M-x describe focus-follows-mouse, it shows t, which is wrong. So I instead added the following to my .emacs:

(setq focus-follows-mouse nil)

and now everything is back to normal. Why did that setting break things? Not sure. Maybe Emacs didn't call something it should have called assuming X would take care of it. Or the other way around. Anyhow, it's much better now.

Some details on my setup:
  • Ubuntu 12.04 Precise Pangolin
  • Emacs 23.3.

Friday, February 8, 2008

Compiling xemacs 21.5.28 on Ubuntu 7.10

I'm actually now a GNU Emacs user, not an XEmacs user, but in case this is helpful to anyone I've recorded how I figured out how to the get the XEmacs source to compile on Ubuntu 7.10.

The reason I'm no longer an XEmacs user is because it's just not keeping up with GNU Emacs, but more importantly, there is an extremely annoying bug...

Update: It appears that the "Xlib: unexpected async reply" that I refer to above is fixed in Ubuntu 8.04. Too bad I'm now using GNU Emacs...