home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / gnu / lucid / bug-lucid-emacs / text0195.txt < prev    next >
Encoding:
Text File  |  1993-07-04  |  6.0 KB  |  137 lines

  1. Dave Gillespie wrote:
  2. > Jamie Zawinski writes:
  3. >> What do you think is better about RMS's event and keymap model, beyond
  4. >> the fact that it was there first (i.e., compatibility)?
  5. > One:  Simple keystroke events are represented the same as they were
  6. > before, which goes a long way toward compatibility with Emacs 18.
  7.  
  8. Yes, I realize this; that's why I said "beyond compatibility."  I wanted
  9. to know what you meant besides this.
  10.  
  11. > The mapping between strings and event vectors is much more natural,
  12. > leading GNU Emacs 19 to provide still more compatibility in that area.
  13.  
  14. Keys and buffer-characters are not the same thing.  Strings are made 
  15. of the stuff that buffers are made of.  Keys are not.  Show me how to
  16. represent Control-Shift-A or Control-Backspace in a string.
  17.  
  18. > Two:  The most common events are atomic objects, which means he doesn't
  19. > need to resort to explicit memory management of event objects to keep
  20. > from garbage collecting all day long.
  21.  
  22. You don't need to resort to explicit memory management.  You can drop the
  23. events on the floor and they will be garbage collected like any other lisp
  24. object.  It's simply more efficient to reuse them (this probably only 
  25. matters in one place in all of emacs: the single event that is reused by
  26. the main command loop; and even there it hardly matters at all.)
  27.  
  28. It such a common misconception that you *need* to explicitly manage events
  29. that I'm starting to regret that I made it possible at all...
  30.  
  31. > Three:  Events and keymaps are built from plain Lisp objects, which
  32. > makes them easier to examine during debugging, and easier to construct
  33. > and modify if necessary.
  34.  
  35. And harder to programmatically tell apart from other things ("eventp" is
  36. unpleasantly heuristic.)  But perhaps they should be less opaque; give me
  37. examples where you've wanted this.
  38.  
  39. > Four:  Events are more usage-oriented, less X-oriented.  This will
  40. > probably make for an easier transition to other window systems in
  41. > the future.
  42.  
  43. I very carefully designed the event structures to expose only those 
  44. components that emacs would need when running under *any* window system.
  45. They are not X specific at all; why do you say they are?
  46.  
  47. > The Lucid model acts on the click, whereas RMS's model usually acts on
  48. > the release.
  49.  
  50. Lucid delivers both up and down events, and you can bind commands to either.
  51.  
  52. > This seems to work fine in practice and allows him to generate drag events
  53. > for the user.  (Although he doesn't yet, he could also generate double-click
  54. > events on the second of two consecutive clicks---hint hint, nudge nudge.)
  55.  
  56. Handling of double click and drag events is controverial and varies from
  57. window system to window system.  That's why I didn't build them into the
  58. C substrate, but instead made them be processed up in lisp.  (But this is
  59. a tangential point; if you want to talk more about it, send me mail.)
  60.  
  61. > It also fixes the stupid problem where mouse commands leave a message
  62. > behind only to have it erased when the release-event is processed.
  63.  
  64. Hey, this is just a *bug*, it has nothing to do with the event model per se...
  65.  
  66. > B:  All events have the same representation, which has a certain
  67. > elegance to it.  (This elegance is muffled by the need to keep the
  68. > garbage collector away from event management, though.)
  69.  
  70. See above.
  71.  
  72. > GNU Emacs simply has both.  If there is a character in unread-command-char,
  73. > it stuffs it into the input stream, and if there are events in
  74. > unread-command-events, it stuffs those, too.  There is some order
  75. > of priority, but it doesn't really matter.
  76. > You could still have retained compatibility by using the name
  77. > "unread-command-char" instead of "unread-command-event" for your
  78. > current variable, and allowing it to contain integers as well as
  79. > event objects.
  80.  
  81. The reason I didn't do this is that the canonical use of unread-command-char
  82. is something like this:
  83.  
  84.   (let ((c (read-char)))
  85.     (if (= c 32)
  86.     (progn ... )
  87.       (setq unread-command-char c)))
  88.  
  89. If the user types some key with an unambiguous ASCII equivalent, this works
  90. fine.  But what if the user types Control-Shift-A or Shift-Linefeed, which 
  91. have no ASCII equivalent. Right now, lemacs's read-char signals an error when
  92. C-Sh-A is typed, and returns 10 for Sh-LFD (the same as LFD).  This means that
  93. either this code would fail to work with many otherwise legitimate keystrokes,
  94. or would unread LFD instead of Sh-LFD, which could have a different binding.
  95. Likewise, when this code reads and unreads \010, we lose the distinction
  96. between Control-h and Backspace.
  97.  
  98. Again, maybe you think that compatibility is more important than the feature
  99. that BS and C-h aren't the same thing.  That's a perfectly legitimate opinion.
  100. But I can't think of a way to have both.  
  101.  
  102. Using the FSF19 model, an int would be returned for C-a and an "event" would
  103. be returned for C-Sh-A.  But what about BS/C-h?  Which one returns an event?
  104. Both are equally bad choices.
  105.  
  106. > Maybe RMS' system has evolved since you first saw it.  He represents
  107. > function keys as symbols, and he can also represent a full set of modifier
  108. > bits on printable keys.  In terms of keys themselves, both systems are
  109. > equally expressive as far as I can see.
  110.  
  111. The last time I checked, C-h, C-Shift-H, BS, C-BS, and C-Shift-BS were not 
  112. distinguishable in the FSF version.  Has this changed?
  113.  
  114. > Yes, but there are about a zillion places in Calc where I stuff an
  115. > event that I *know* is a printable character, and I had to change
  116. > every single one of these.
  117.  
  118. I understand that you've had massive compatibility problems.  But in my
  119. defense, I think that Calc is about as atypical an emacs application as you
  120. can find.  Most packages just don't work that way; by far the most common
  121. use of unread-command-char is to unread an arbitrary character read from
  122. the user.
  123.  
  124. > Your model does not detect incompatible code, either, because older
  125. > programs can simply go ahead and store something in "unread-command-char"
  126. > and then silently fail.
  127.  
  128. Yes, this is true.  However, it does issue a compilation warning.  I could
  129. make setq signal an error when storing into unread-command-char, but that
  130. seems pretty perverse...
  131.  
  132.     -- Jamie
  133.  
  134.