From xemacs-m  Fri Mar 21 16:03:44 1997
Received: from mailbox2.ucsd.edu (mailbox2.ucsd.edu [132.239.1.54])
	by xemacs.org (8.8.5/8.8.5) with ESMTP id QAA22971
	for <xemacs-beta@xemacs.org>; Fri, 21 Mar 1997 16:03:44 -0600 (CST)
Received: from sdnp5.ucsd.edu (sdnp5.ucsd.edu [132.239.79.10]) by mailbox2.ucsd.edu (8.8.5/8.6.9) with SMTP id OAA09657 for <xemacs-beta@xemacs.org>; Fri, 21 Mar 1997 14:03:12 -0800 (PST)
Received: by sdnp5.ucsd.edu (SMI-8.6/SMI-SVR4)
	id OAA24977; Fri, 21 Mar 1997 14:02:45 -0800
Sender: dmoore@sdnp5.ucsd.edu
To: xemacs-beta@xemacs.org
Subject: Re: xemacs-19.15b102 items
References: <bciend9yook.fsf@corp.Sun.COM>
X-Face: "oX;zS#-JU$-,WKSzG.1gGE]x^cIg!hW.dq>.f6pzS^A+(k!T|M:}5{_%>Io<>L&{hO7W4cicOQ|>/lZ1G(m%7iaCf,6Qgk0%%Bz7b2-W3jd0m_UG\Y;?]}4s0O-U)uox>P3JN)9cm]O\@,vy2e{`3pb!"pqmRy3peB90*2L
Mail-Copies-To: never
Mime-Version: 1.0 (generated by tm-edit 7.105)
Content-Type: text/plain; charset=US-ASCII
From: David Moore <dmoore@ucsd.edu>
Date: 21 Mar 1997 14:02:45 -0800
In-Reply-To: Gary.Foster@Corp.Sun.COM's message of 21 Mar 1997 12:28:59 -0800
Message-ID: <rv913gvr7e.fsf@sdnp5.ucsd.edu>
Lines: 38
X-Mailer: Gnus v5.4.28/XEmacs 19.15(beta100)

Gary.Foster@Corp.Sun.COM (Gary D. Foster) writes:

[ random buffer switching ]

> (defun gdf-gnus-scan-mail ()
>   "Scan level 2 nnml groups."
>   (gnus-group-get-new-news 2))
> 
> But it definately seems to happen right when this fires off.  Not
> every time, though, but almost always freaks out if I'm typing when
> the daemon-handler fires.

This handler you've installed is asking XEmacs to change buffers on
you.  :)

I suggest:

(defun gdf-gnus-scan-mail ()
  "Scan level 2 nnml groups."
  (save-window-excursion
    (when (gnus-alive-p)
      (save-excursion
        (set-buffer gnus-group-buffer)
        (gnus-group-get-new-news 2)))))


For any timed events, you must be very careful not to change the notion
of current-buffer.  In addition to simple annoyances like having buffers
switch, you can seriously break some things.  If a timer event runs
during a `sit-for' or `accept-process-output', etc, and changes the
current buffer, the code which did the sit-for might now scribble into a
wrong buffer causing all sorts of problems.

-- 
David Moore <dmoore@ucsd.edu>       | Computer Systems Lab      __o
UCSD Dept. Computer Science - 0114  | Work: (619) 534-8604    _ \<,_
La Jolla, CA 92093-0114             | Fax:  (619) 534-1445   (_)/ (_)
<URL:http://oj.egbt.org/dmoore/>    | In a cloud bones of steel.

