Updated patch attached. (A note for Michael: I know about the ring.el library, but it would have been necessary to require it in frame.el, which is not necessary, given that it's easy to get the same effect with standard functions.)