XEmacs -- Emacs: The Next Generation
     Searching XEmacs
Quick Links About XEmacs Getting XEmacs Customizing XEmacs Troubleshooting XEmacs Developing XEmacs

Removal of misc-user Event Type

Abstract: This page describes why the misc-user event type should be split up into a number of different event types, and how to do this.

The misc-user event should not exist as a single event type. It should be split up into a number of different event types: one for scrollbar events, one for menu events, and one or two for drag-n-drop events. Possibly there will be other event types created in the future. The reason for this is that the misc-user event was a bad design choice when I made it, and it has only gotten worse with Oliver's attempts to add features to it to make it be used for drag-n-drop. I know that there was originally a separate drag-n-drop event type, and it was folded into the misc-user event type on my recommendation, but I have now realized the error of my ways. I had originally created a single event type in an attempt to prevent some Lisp programs from breaking because they might have a case statement over various event types, and would not be able to handle new event types appearing. I think now that these programs simply need to be written in a way to handle new event types appearing. It's not very hard to do this. You just use predicates instead of doing a case statement over the event type. If we preserve the existing predicate called misc-user-event-p, and just make sure that it evaluates to true when given any user event type other than the standard simple ones, then most existing code will not break either when we split the event types up like this, or if we add any new event types in the future.

More specifically, the only clean way to design the misc-user event type would be to add a sub-type field to it, and then have the nature of all the other fields in the event type be dependent on this sub-type. But then in essence, we'd just be reimplementing the whole event-type scheme inside of misc-user events, which would be rather pointless.

Ben Wing

Conform with <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Automatically validated by PSGML