"Chong Yidong" <[EMAIL PROTECTED]> writes: > Do `emacs -Q', turn on global-font-lock-mode, and visit a long file -- > say, `.emacs'. Now go back to the `*scratch*' buffer and evaluate the > following: > > (defun check-buffer () > (if (not (eq (current-buffer) my-buffer)) > (message "Foo: %s" (buffer-name (current-buffer))))) > > (setq my-buffer (current-buffer)) > (run-with-timer 0.1 0.1 'check-buffer) > > Wait for around five seconds. You will see: > > Foo: .emacs > > You need to have font-lock enabled, and there has to be a long fontified > buffer lurking around somewhere. My guess is that the font-lock engine is > doing stuff while waiting for input, which causes current-buffer to be > different when the timer calls the function. > > This has the unfortunate consequence of breaking Pong.
Which would be the fault of whatever Pong is. run-with-timer does not guarantee you any particular buffer. You can always make do with (run-with-timer 0.1 0.1 `(lambda () (with-current-buffer ,(current-buffer) (whateverfunction)))) -- David Kastrup, Kriemhildstr. 15, 44793 Bochum _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel