[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Mysterious buffer switching
From: |
Chong Yidong |
Subject: |
Mysterious buffer switching |
Date: |
Sun, 27 Feb 2005 09:29:07 -0500 (EST) |
User-agent: |
SquirrelMail/1.4.4 |
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.
- Mysterious buffer switching,
Chong Yidong <=