From xemacs-m  Wed Sep 17 10:36:32 1997
Received: from MIT.EDU (PACIFIC-CARRIER-ANNEX.MIT.EDU [18.69.0.28])
	by xemacs.org (8.8.5/8.8.5) with SMTP id KAA10461
	for <xemacs-beta@xemacs.org>; Wed, 17 Sep 1997 10:36:31 -0500 (CDT)
Received: from TEN-THOUSAND-DOLLAR-BILL.MIT.EDU by MIT.EDU with SMTP
	id AA20820; Wed, 17 Sep 97 11:36:32 EDT
Received: by ten-thousand-dollar-bill.MIT.EDU (8.8.5/4.7) id LAA17712; Wed, 17 Sep 1997 11:36:31 -0400 (EDT)
Date: Wed, 17 Sep 1997 11:36:31 -0400 (EDT)
Message-Id: <199709171536.LAA17712@ten-thousand-dollar-bill.MIT.EDU>
From: David Bakhash <cadet@MIT.EDU>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
To: XEmacs Developers <xemacs-beta@xemacs.org>
Subject: Re: [PATCH] `make-event' accepts arguments
In-Reply-To: <kig4t7kc9k6.fsf@jagor.srce.hr>
References: <kigk9gg8zp6.fsf@jagor.srce.hr>
	<199709170223.WAA20747@M66-080-21.MIT.EDU>
	<ocrsov46nzu.fsf@ml.com>
	<kig4t7kc9k6.fsf@jagor.srce.hr>
X-Mailer: VM 6.31 under 20.2 XEmacs Lucid

Hrvoje Niksic writes:
 > Colin Rafferty <craffert@ml.com> writes:
 > 
 > > For example, I don't use strokes (in fact, I don't use the mouse except
 > > for X cutting and pasting).  However, I want to read strokesified mail.
 > > I do not want to lose the middle mouse button just because I want to
 > > read strokes.
 > 
 > You won't.  The point David was trying to make is that a simple press
 > and release of button2 will *always* be let to normal uses
 > (x-insert-selection or whatever).  Only *dragging* of button2 will be
 > read as a stroke.

yes.  right now, the method that strokes uses to have button-2 bound to
`strokes-do-stroke' when a local keymap overriedes the global-map
setting of button-2 is with defadvice.  so something like
vm-mouse-button-2 ends up doing this (symbolically...):

(defadvice vm-mouse-button-2 (event)
  (let ((strokes-click-command 'ad-Orig-vm-mouse-button-2))
    (strokes-do-stroke (ad-get-arg 0))))

so actually, the vm-mouse-button-2 function really only passes the event 
off to `strokes-do-stroke', and the only way that strokes-do-stroke
knows to funcall 'vm-mouse-button-2 is with that dynamic let on
`strokes-click-command'.  It works just fine, but the problem is that no 
one (including me) things that defadvice is the best way to go.  again,
the new ``make-event'' way to go about it would require:

1) having an excellent way to see if the event is a click or a drag
   (which is done in strokes)
2) if the button-2 event was a click: having xemacs create an event with
   the same plist as the event it just got, and dispatch that.

It all amounts to the same thing: when the user wants strokes, s/he
gives button-2 to strokes.  I asked for months on the newsgroup and to
xemacs-beta-discuss, and made numerous (taxing) visits to RMS's office
at MIT trying to solve this more elegantly.  RMS had a solution for
emacs, though I didn't like it.  (since emacs events are nothing more
than a plist, you can make an event by constructing a list, and then
push it on the the `unread-command-events' list.  if jwz/KJ, or anyone
else wouldn't mind providing a better solution, then I guess I'm okay
with the present defadvice.  I agree w/ jwz/KJ that if ``make-event''
weakens the event API, and allows users to break XEmacs, then it's not
right, and shouldn't be done.  but can't make-event (in C) check the
plist from LISP and make sure that there's nothing there that can cause
harm?  pass it off as a bogus event?  Or at least be able to provide a
way to make a new XEmacs event with some limitations.  If a user can
make an event by pushing a button, then a language spec should certainly
have a way to construct this in some form or another (IMO).  Please take 
everything I say w/ a grain of salt and be easy on me as I am a new
programmer, know very little, and am mostly ignorant.  the last thing I
want is to brake something that works (like XEmacs) so strokes works.
This wouldn't even make sense.

dave

