home *** CD-ROM | disk | FTP | other *** search
- Dave Gillespie wrote:
- >
- > Jamie Zawinski writes:
- >> What do you think is better about RMS's event and keymap model, beyond
- >> the fact that it was there first (i.e., compatibility)?
- >
- > One: Simple keystroke events are represented the same as they were
- > before, which goes a long way toward compatibility with Emacs 18.
-
- Yes, I realize this; that's why I said "beyond compatibility." I wanted
- to know what you meant besides this.
-
- > The mapping between strings and event vectors is much more natural,
- > leading GNU Emacs 19 to provide still more compatibility in that area.
-
- Keys and buffer-characters are not the same thing. Strings are made
- of the stuff that buffers are made of. Keys are not. Show me how to
- represent Control-Shift-A or Control-Backspace in a string.
-
- > Two: The most common events are atomic objects, which means he doesn't
- > need to resort to explicit memory management of event objects to keep
- > from garbage collecting all day long.
-
- You don't need to resort to explicit memory management. You can drop the
- events on the floor and they will be garbage collected like any other lisp
- object. It's simply more efficient to reuse them (this probably only
- matters in one place in all of emacs: the single event that is reused by
- the main command loop; and even there it hardly matters at all.)
-
- It such a common misconception that you *need* to explicitly manage events
- that I'm starting to regret that I made it possible at all...
-
- > Three: Events and keymaps are built from plain Lisp objects, which
- > makes them easier to examine during debugging, and easier to construct
- > and modify if necessary.
-
- And harder to programmatically tell apart from other things ("eventp" is
- unpleasantly heuristic.) But perhaps they should be less opaque; give me
- examples where you've wanted this.
-
- > Four: Events are more usage-oriented, less X-oriented. This will
- > probably make for an easier transition to other window systems in
- > the future.
-
- I very carefully designed the event structures to expose only those
- components that emacs would need when running under *any* window system.
- They are not X specific at all; why do you say they are?
-
- > The Lucid model acts on the click, whereas RMS's model usually acts on
- > the release.
-
- Lucid delivers both up and down events, and you can bind commands to either.
-
- > This seems to work fine in practice and allows him to generate drag events
- > for the user. (Although he doesn't yet, he could also generate double-click
- > events on the second of two consecutive clicks---hint hint, nudge nudge.)
-
- Handling of double click and drag events is controverial and varies from
- window system to window system. That's why I didn't build them into the
- C substrate, but instead made them be processed up in lisp. (But this is
- a tangential point; if you want to talk more about it, send me mail.)
-
- > It also fixes the stupid problem where mouse commands leave a message
- > behind only to have it erased when the release-event is processed.
-
- Hey, this is just a *bug*, it has nothing to do with the event model per se...
-
- > B: All events have the same representation, which has a certain
- > elegance to it. (This elegance is muffled by the need to keep the
- > garbage collector away from event management, though.)
-
- See above.
-
- > GNU Emacs simply has both. If there is a character in unread-command-char,
- > it stuffs it into the input stream, and if there are events in
- > unread-command-events, it stuffs those, too. There is some order
- > of priority, but it doesn't really matter.
- >
- > You could still have retained compatibility by using the name
- > "unread-command-char" instead of "unread-command-event" for your
- > current variable, and allowing it to contain integers as well as
- > event objects.
-
- The reason I didn't do this is that the canonical use of unread-command-char
- is something like this:
-
- (let ((c (read-char)))
- (if (= c 32)
- (progn ... )
- (setq unread-command-char c)))
-
- If the user types some key with an unambiguous ASCII equivalent, this works
- fine. But what if the user types Control-Shift-A or Shift-Linefeed, which
- have no ASCII equivalent. Right now, lemacs's read-char signals an error when
- C-Sh-A is typed, and returns 10 for Sh-LFD (the same as LFD). This means that
- either this code would fail to work with many otherwise legitimate keystrokes,
- or would unread LFD instead of Sh-LFD, which could have a different binding.
- Likewise, when this code reads and unreads \010, we lose the distinction
- between Control-h and Backspace.
-
- Again, maybe you think that compatibility is more important than the feature
- that BS and C-h aren't the same thing. That's a perfectly legitimate opinion.
- But I can't think of a way to have both.
-
- Using the FSF19 model, an int would be returned for C-a and an "event" would
- be returned for C-Sh-A. But what about BS/C-h? Which one returns an event?
- Both are equally bad choices.
-
- > Maybe RMS' system has evolved since you first saw it. He represents
- > function keys as symbols, and he can also represent a full set of modifier
- > bits on printable keys. In terms of keys themselves, both systems are
- > equally expressive as far as I can see.
-
- The last time I checked, C-h, C-Shift-H, BS, C-BS, and C-Shift-BS were not
- distinguishable in the FSF version. Has this changed?
-
- > Yes, but there are about a zillion places in Calc where I stuff an
- > event that I *know* is a printable character, and I had to change
- > every single one of these.
-
- I understand that you've had massive compatibility problems. But in my
- defense, I think that Calc is about as atypical an emacs application as you
- can find. Most packages just don't work that way; by far the most common
- use of unread-command-char is to unread an arbitrary character read from
- the user.
-
- > Your model does not detect incompatible code, either, because older
- > programs can simply go ahead and store something in "unread-command-char"
- > and then silently fail.
-
- Yes, this is true. However, it does issue a compilation warning. I could
- make setq signal an error when storing into unread-command-char, but that
- seems pretty perverse...
-
- -- Jamie
-
-