From xemacs-m  Wed Apr 30 11:23:06 1997
Received: from wfdutilgw.ml.com (wfdutilf01.ml.com [206.3.74.31])
	by xemacs.org (8.8.5/8.8.5) with ESMTP id LAA10484
	for <xemacs-beta@xemacs.org>; Wed, 30 Apr 1997 11:23:05 -0500 (CDT)
Received: from ml1.ml.com ([199.201.57.130])
	by wfdutilgw.ml.com (8.8.5/8.8.5/MLgw-3.03) with ESMTP id MAA12267;
	Wed, 30 Apr 1997 12:19:42 -0400 (EDT)
Received: from commpost.ml.com (commpost.ml.com [146.125.4.24])
	by ml1.ml.com (8.8.5/8.8.5/MLml4-2.07) with SMTP id MAA09105;
	Wed, 30 Apr 1997 12:25:18 -0400 (EDT)
Received: from spssunp.spspme.ml.com (spssunp.spspme.ml.com [192.168.111.13]) by commpost.ml.com (8.6.12/8.6.12) with ESMTP id MAA10478; Wed, 30 Apr 1997 12:24:44 -0400
Received: by spssunp.spspme.ml.com (SMI-8.6/SMI-4.1)
	id MAA04638; Wed, 30 Apr 1997 12:11:47 -0400
To: XEmacs Beta List <xemacs-beta@xemacs.org>
Cc: BBDB List <info-bbdb@cs.uiuc.edu>
Subject: Re: BBDB-1.51 or XEmacs-20.2-b1 bug?
References: <rxsn2qg6936.fsf@midnight.ecf.teradyne.com>
X-Face: D>:hrrB{l6#\wU;)0R:OHSTA@ayd.Oq?s@Rrc;[+z0m+<-U"$G-J6L)F2QY`qK~uPu!s1(6{\#uy!Ag/D)?'L[}xErXvxoPn8T_hKi{M]/(`BF{e}X7;hby`p\.E$rJ}Aff#BT,rdDIw\y
X-Y-Zippy: My FAVORITE group is "QUESTION MARK & THE MYSTERIANS"...
Mime-Version: 1.0 (generated by tm-edit 7.106)
Content-Type: multipart/mixed;
 boundary="Multipart_Wed_Apr_30_12:11:45_1997-1"
Content-Transfer-Encoding: 7bit
From: Colin Rafferty <craffert@ml.com>
Date: 30 Apr 1997 12:11:45 -0400
In-Reply-To: Adrian Aichner's message of 30 Apr 1997 13:31:09 +0200
Message-ID: <ocr67x4pk1q.fsf@spssunp.spspme.ml.com>
Lines: 78
X-Mailer: Gnus v5.4.45/XEmacs 20.1

--Multipart_Wed_Apr_30_12:11:45_1997-1
Content-Type: text/plain; charset=US-ASCII


Adrian Aichner writes:

> this will not be very analytical, I'm afraid.
> It took me a long time to even come up with a reproducible test case.

Your message was enough of a test case for me to reproduce it, and find
a more general way to reproduce it.

This is an XEmacs bug, not BBDB.  I have managed to reproduce it without
any extra libraries.  Those on the BBDB list can safely ignore the rest
of the article (like they really wanted to pay attention if they were
not on the XEmacs beta list).

The basic problem is that `Electric-command-loop' no longer has a clause
in it that checks to see that we have not left the buffer.

To reproduce, in a running XEmacs:

1. Run `M-x electric-command-history' (or any other "electric" command).

2. use the mouse to switch focus to another buffer, in the current
   frame, or in another.

3. Try typing in the other buffer.  Each `self-insert-command' will
   insert the last chacter that you typed to invoke the electric
   command.  This example will have it insert a ^M.  I personally have
   `C-x C-b' bound to `electric-buffer-list', so I get a ^B inserted.

I have patched the code, basically by inserting back the code that was
removed at some point.  However, there are still two lingering bugs.

The first bug is that if the `Electric-command-loop' has not split the
screen, changing frames is not detected.  You can reproduce this with
`electric-buffer-list' when there are more buffers than lines on the
frame.  Call e-b-l, move the mouse to a different window, and type.
Even with the patch, this has the same bug.

The other bug is that when focus changes are recognized correctly, they
do this only after an incorrect character has been inserted.

Here is the patch:


--Multipart_Wed_Apr_30_12:11:45_1997-1
Content-Type: application/octet-stream
Content-Disposition: attachment; filename="patch"
Content-Transfer-Encoding: 8bit

*** lisp/electric/electric.el.orig	Wed Dec 18 17:49:58 1996
--- lisp/electric/electric.el	Wed Apr 30 11:46:06 1997
***************
*** 143,148 ****
--- 143,155 ----
  				(prin1-to-string conditions)))
  		     (sit-for 2))))
  	(ding))
+       (and (not (eq (current-buffer) electrified-buffer)) ; XEmacs -
+ 	   (not (eq (selected-window) (minibuffer-window)))
+ 	   (progn (ding nil 'quit)
+ 		  (message "Leaving electric command loop %s."
+ 			   "because buffer has changed")
+ 		  (sit-for 2)
+ 		  (throw return-tag nil)))
        (if loop-function (funcall loop-function loop-state err))))
    ;; XEmacs - huh?  It should be impossible to ever get here...
    (ding nil 'alarm)

--Multipart_Wed_Apr_30_12:11:45_1997-1
Content-Type: text/plain; charset=US-ASCII

-- 
Colin

--Multipart_Wed_Apr_30_12:11:45_1997-1--

