Hi, @Tom, thanks for this nice snippet! Very useful, when several emacs frames are opened.
While it works well on my emacs23, the emacs24 snapshot from http://emacs.naquadah.org/ crashes, when I select a template. Is this a general issue with emacs24? Ideas to adapt the snippet to work with emacs24? Thank in advance, Andreas