unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Mysterious buffer switching
@ 2005-02-27 14:29 Chong Yidong
  2005-02-27 19:01 ` David Kastrup
  2005-02-28 11:25 ` Richard Stallman
  0 siblings, 2 replies; 4+ messages in thread
From: Chong Yidong @ 2005-02-27 14:29 UTC (permalink / raw)


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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-02-28 13:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-02-27 14:29 Mysterious buffer switching Chong Yidong
2005-02-27 19:01 ` David Kastrup
2005-02-28 11:25 ` Richard Stallman
2005-02-28 13:46   ` Chong Yidong

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).