changeset 2828:a25c824ed558

[xemacs-hg @ 2005-06-26 18:04:49 by aidan] Rename the ascii-character property, support more keysyms.
author aidan
date Sun, 26 Jun 2005 18:05:05 +0000
parents 936a6576c655
children 714b354cef67
files lisp/ChangeLog lisp/cmdloop.el lisp/dumped-lisp.el lisp/events.el lisp/gtk-compose.el lisp/isearch-mode.el lisp/keymap.el lisp/x-compose.el lisp/x-init.el man/ChangeLog man/internals/internals.texi man/lispref/commands.texi man/lispref/keymaps.texi src/ChangeLog src/cmds.c src/console-gtk.c src/console-impl.h src/console-msw.c src/console-tty.c src/console-x.c src/device-gtk.c src/device-x.c src/editfns.c src/event-Xt.c src/event-msw.c src/event-stream.c src/event-xlike-inc.c src/events.c src/events.h src/keymap.c src/lisp.h src/sysdep.c
diffstat 32 files changed, 1728 insertions(+), 691 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Sat Jun 25 21:51:12 2005 +0000
+++ b/lisp/ChangeLog	Sun Jun 26 18:05:05 2005 +0000
@@ -1,3 +1,27 @@
+2005-06-26  Aidan Kehoe  <kehoea@parhasard.net>
+
+	* cmdloop.el (read-quoted-char):
+	* isearch-mode.el (isearch-char-to-string):
+	Remove the fourth argument from event-to-character. 
+	
+	* dumped-lisp.el (preloaded-file-list):
+	No longer dump x-iso8859-1.el--we don't need it any more. 
+
+	* x-init.el (x-initialize-keyboard):
+	* keymap.el (events-to-keys):	
+	* events.el:
+	Rename the ascii-character keysym property to character-of-keysym. 
+
+	* gtk-compose.el:
+	Don't depend on gtk-iso8859-1.el
+
+	* x-compose.el:
+	Move to using character literals rather than X11 keysyms as macro
+	expansions. Loses the ability to use another character encoding
+	for the Latin-1 characters in X11 composition with a bit of
+	programming, which no-one uses; also happily reduces dependence on
+	x-iso8859-1.el, which is no longer of use.
+
 2005-06-06  Adrian Aichner  <adrian@xemacs.org>
 
 	* package-get.el (package-get-init-package):
--- a/lisp/cmdloop.el	Sat Jun 25 21:51:12 2005 +0000
+++ b/lisp/cmdloop.el	Sun Jun 26 18:05:05 2005 +0000
@@ -567,7 +567,7 @@
 any other non-digit terminates the character code and is then used as input."))
 	(and prompt (display-message 'prompt (format "%s-" prompt)))
 	(setq event (next-command-event)
-	      char (or (event-to-character event nil nil t)
+	      char (or (event-to-character event)
 		       (signal 'error
 			       (list "key read cannot be inserted in a buffer"
 				     event))))
--- a/lisp/dumped-lisp.el	Sat Jun 25 21:51:12 2005 +0000
+++ b/lisp/dumped-lisp.el	Sun Jun 26 18:05:05 2005 +0000
@@ -246,8 +246,7 @@
 ;; preload the X code.
        (when (featurep '(and x scrollbar)) "x-scrollbar")
        (when (featurep 'x)
-	 '("x-iso8859-1"
-	   "x-mouse"
+	 '("x-mouse"
 	   "x-select"
 	   "x-misc"
 	   "x-init"
@@ -259,7 +258,6 @@
 	   "gtk-widgets"
 	   "gdk"
 	   "gtk-init"
-	   "gtk-iso8859-1"
 	   "gtk-select"
 	   "gtk-mouse"
 	   "gtk-glyphs"
--- a/lisp/events.el	Sat Jun 25 21:51:12 2005 +0000
+++ b/lisp/events.el	Sun Jun 26 18:05:05 2005 +0000
@@ -120,39 +120,59 @@
   (while pairs
     (puthash (pop pairs) (pop pairs) keyboard-translate-table)))
 
-(put 'tab       'ascii-character ?\t)
-(put 'linefeed  'ascii-character ?\n)
-(put 'clear     'ascii-character 12)
-(put 'return    'ascii-character ?\r)
-(put 'escape    'ascii-character ?\e)
-(put 'space	'ascii-character ? )
+(defun set-character-of-keysym (keysym character)
+  "Make CHARACTER be inserted when KEYSYM is pressed, 
+and the key has been bound to `self-insert-command'.  "
+  (check-argument-type 'symbolp keysym) 
+  (check-argument-type 'characterp character)
+  (put keysym 'character-of-keysym character))
+
+(defun get-character-of-keysym (keysym)
+  "Return the character inserted when KEYSYM is pressed, 
+and the key is bound to `self-insert-command'.  "
+  (check-argument-type 'symbolp keysym)
+  (event-to-character (make-event 'key-press (list 'key keysym))))
+
+;; We could take the first few of these out by removing the "/* Optimize for
+;; ASCII keysyms */" code in event-Xt.c, and I've a suspicion that may be
+;; the right thing to do anyway.
+
+(loop for (keysym char) in
+  '((tab ?\t)
+    (linefeed ?\n)
+    (clear ?\014)
+    (return ?\r)
+    (escape ?\e)
+    (space ? )
 
- ;; Do the same voodoo for the keypad keys.  I used to bind these to keyboard
- ;; macros (for instance, kp-0 was bound to "0") so that they would track the
- ;; bindings of the corresponding keys by default, but that made the display
- ;; of M-x describe-bindings much harder to read, so now we'll just bind them
- ;; to self-insert by default.  Not a big difference...
- 
-(put 'kp-0 'ascii-character ?0)
-(put 'kp-1 'ascii-character ?1)
-(put 'kp-2 'ascii-character ?2)
-(put 'kp-3 'ascii-character ?3)
-(put 'kp-4 'ascii-character ?4)
-(put 'kp-5 'ascii-character ?5)
-(put 'kp-6 'ascii-character ?6)
-(put 'kp-7 'ascii-character ?7)
-(put 'kp-8 'ascii-character ?8)
-(put 'kp-9 'ascii-character ?9)
+    ;; Do the same voodoo for the keypad keys.  I used to bind these to
+    ;; keyboard macros (for instance, kp-0 was bound to "0") so that they
+    ;; would track the bindings of the corresponding keys by default, but
+    ;; that made the display of M-x describe-bindings much harder to read,
+    ;; so now we'll just bind them to self-insert by default.  Not a big
+    ;; difference...
 
-(put 'kp-space     'ascii-character ? )
-(put 'kp-tab       'ascii-character ?\t)
-(put 'kp-enter     'ascii-character ?\r)
-(put 'kp-equal     'ascii-character ?=)
-(put 'kp-multiply  'ascii-character ?*)
-(put 'kp-add       'ascii-character ?+)
-(put 'kp-separator 'ascii-character ?,)
-(put 'kp-subtract  'ascii-character ?-)
-(put 'kp-decimal   'ascii-character ?.)
-(put 'kp-divide    'ascii-character ?/)
+    (kp-0 ?0)
+    (kp-1 ?1)
+    (kp-2 ?2)
+    (kp-3 ?3)
+    (kp-4 ?4)
+    (kp-5 ?5)
+    (kp-6 ?6)
+    (kp-7 ?7)
+    (kp-8 ?8)
+    (kp-9 ?9)
+
+    (kp-space ? )
+    (kp-tab ?\t)
+    (kp-enter ?\r)
+    (kp-equal ?=)
+    (kp-multiply ?*)
+    (kp-add ?+)
+    (kp-separator ?,)
+    (kp-subtract ?-)
+    (kp-decimal ?.)
+    (kp-divide ?/))
+  do (set-character-of-keysym keysym char))
 
 ;;; events.el ends here
--- a/lisp/gtk-compose.el	Sat Jun 25 21:51:12 2005 +0000
+++ b/lisp/gtk-compose.el	Sun Jun 26 18:05:05 2005 +0000
@@ -1,4 +1,3 @@
-(require 'gtk-iso8859-1)
 (require 'x-compose)
 
 (provide 'gtk-compose)
--- a/lisp/isearch-mode.el	Sat Jun 25 21:51:12 2005 +0000
+++ b/lisp/isearch-mode.el	Sun Jun 26 18:05:05 2005 +0000
@@ -1813,7 +1813,7 @@
 
 (defun isearch-char-to-string (c)
   (if (eventp c)
-      (make-string 1 (event-to-character c nil nil t))
+      (make-string 1 (event-to-character c))
     (make-string 1 c)))
 
 ;(defun isearch-text-char-description (c)
--- a/lisp/keymap.el	Sat Jun 25 21:51:12 2005 +0000
+++ b/lisp/keymap.el	Sun Jun 26 18:05:05 2005 +0000
@@ -338,10 +338,9 @@
             ;; any ambiguity.
             (setq c (event-to-character ce))
             (if (and c
-                     character-set-property
                      (key-press-event-p ce))
                 (cond ((symbolp (event-key ce))
-                       (if (get (event-key ce) character-set-property)
+                       (if (get (event-key ce) 'character-of-keysym)
                            ;; Don't use a string for `backspace' and `tab' to
                            ;;  avoid that unpleasant little ambiguity.
                            (setq c nil)))
@@ -349,7 +348,7 @@
                             (integerp (event-key ce)))
                        (let* ((te (character-to-event c)))
                          (if (and (symbolp (event-key te))
-                                  (get (event-key te) character-set-property))
+                                  (get (event-key te) 'character-of-keysym))
                              ;; Don't "normalize" (control i) to tab
                              ;;  to avoid the ambiguity in the other direction
                              (setq c nil))
--- a/lisp/x-compose.el	Sat Jun 25 21:51:12 2005 +0000
+++ b/lisp/x-compose.el	Sun Jun 26 18:05:05 2005 +0000
@@ -1,6 +1,6 @@
 ;;; x-compose.el --- Compose-key processing in XEmacs
 
-;; Copyright (C) 1992, 1993, 1997 Free Software Foundation, Inc.
+;; Copyright (C) 1992, 1993, 1997, 2005 Free Software Foundation, Inc.
 
 ;; Author: Jamie Zawinski <jwz@jwz.org>
 ;; Maintainer: XEmacs Development Team
@@ -100,9 +100,11 @@
 ;; not have: at any point you can type C-h to get a list of the possible
 ;; completions of what you have typed so far.
 
-;;; Code:
+;; Giacomo Boffi's problem of
+;; 20050324103919.8D22E4901@boffi95.stru.polimi.it is caused by Xlib doing
+;; the compose processing. To turn that off, I'm not certain what's 
 
-(require 'x-iso8859-1)
+;;; Code:
 
 (macrolet
     ((define-compose-map (keymap-symbol)
@@ -157,85 +159,113 @@
 ;;; The contents of the "dead key" maps.  These are shared by the
 ;;; compose-map.
 
+;;; These used to all have nice readable X11-oriented keysym names as the
+;;; macro definition in the third argument, but I moved the interpretation
+;;; of those mappings (that is, Aacute to \301, &c.) to runtime in the X11
+;;; code on first sight of the symbols--which is the more general solution,
+;;; what with Unicode keysyms, publishing, technical and so on, there's no
+;;; need to have them hanging around as symbols all the time--so they're no
+;;; longer available to Lisp before X11 sees them, something this relied on.
+
+;;; The transformation was done like so;
+
+;;;   (while (re-search-forward "\\[\\([a-zA-Z]+\\)\\])$" nil t)
+;;;     (replace-match (format "(?\\%o)" 
+;;;		   (get (intern (match-string 1)) 'character-of-keysym))
+;;;		 t t nil 1))
+ 
+;;; with a lot of repeated calling of setxkbmap to esoteric keymaps--so
+;;; x_reset_key_mapping gets called for all the keys on the keyboard--yacute
+;;; getting picked up from the Czech keymap, idiaeresis from the Dutch one,
+;;; and many more (al, ca, cz, de, dvorak, ee, es, fi, fr, hu,
+;;; ie(UnicodeExpert), it, nl, pt, ro, tr, us, vn, if it interests you.)
+
+;;; The parentheses inside the vector are because otherwise the macro gets
+;;; interpreted as a meta character, the Latin-1 codes being in exactly that
+;;; range. Perhaps that bears documenting somewhere. Also, why is help
+;;; turned off for these (x-compose) sequences by default?
+
+;;; (Aidan Kehoe, 2005-05-18)
+
 (define-key compose-acute-map [space]	"'")
-(define-key compose-acute-map [?']	[acute])
-(define-key compose-acute-map [?A]	[Aacute])
-(define-key compose-acute-map [E]	[Eacute])
-(define-key compose-acute-map [I]	[Iacute])
-(define-key compose-acute-map [O]	[Oacute])
-(define-key compose-acute-map [U]	[Uacute])
-(define-key compose-acute-map [Y]	[Yacute])
-(define-key compose-acute-map [a]	[aacute])
-(define-key compose-acute-map [e]	[eacute])
-(define-key compose-acute-map [i]	[iacute])
-(define-key compose-acute-map [o]	[oacute])
-(define-key compose-acute-map [u]	[uacute])
-(define-key compose-acute-map [y]	[yacute])
+(define-key compose-acute-map [?']	[(?\264)])
+(define-key compose-acute-map [?A]	[(?\301)])
+(define-key compose-acute-map [E]	[(?\311)])
+(define-key compose-acute-map [I]	[(?\315)])
+(define-key compose-acute-map [O]	[(?\323)])
+(define-key compose-acute-map [U]	[(?\332)])
+(define-key compose-acute-map [Y]	[(?\335)])
+(define-key compose-acute-map [a]	[(?\341)])
+(define-key compose-acute-map [e]	[(?\351)])
+(define-key compose-acute-map [i]	[(?\355)])
+(define-key compose-acute-map [o]	[(?\363)])
+(define-key compose-acute-map [u]	[(?\372)])
+(define-key compose-acute-map [y]	[(?\375)])
 
 (define-key compose-grave-map [space]	"`")
-(define-key compose-grave-map [?`]	[grave])
-(define-key compose-grave-map [A]	[Agrave])
-(define-key compose-grave-map [E]	[Egrave])
-(define-key compose-grave-map [I]	[Igrave])
-(define-key compose-grave-map [O]	[Ograve])
-(define-key compose-grave-map [U]	[Ugrave])
-(define-key compose-grave-map [a]	[agrave])
-(define-key compose-grave-map [e]	[egrave])
-(define-key compose-grave-map [i]	[igrave])
-(define-key compose-grave-map [o]	[ograve])
-(define-key compose-grave-map [u]	[ugrave])
+(define-key compose-grave-map [?`]	[(?\140)])
+(define-key compose-grave-map [A]	[(?\300)])
+(define-key compose-grave-map [E]	[(?\310)])
+(define-key compose-grave-map [I]	[(?\314)])
+(define-key compose-grave-map [O]	[(?\322)])
+(define-key compose-grave-map [U]	[(?\331)])
+(define-key compose-grave-map [a]	[(?\340)])
+(define-key compose-grave-map [e]	[(?\350)])
+(define-key compose-grave-map [i]	[(?\354)])
+(define-key compose-grave-map [o]	[(?\362)])
+(define-key compose-grave-map [u]	[(?\371)])
 
 (define-key compose-cedilla-map [space]	",")
-(define-key compose-cedilla-map [?,]	[cedilla])
-(define-key compose-cedilla-map [C]	[Ccedilla])
-(define-key compose-cedilla-map [c]	[ccedilla])
+(define-key compose-cedilla-map [?,]	[(?\270)])
+(define-key compose-cedilla-map [C]	[(?\307)])
+(define-key compose-cedilla-map [c]	[(?\347)])
 
-(define-key compose-diaeresis-map [space] [diaeresis])
-(define-key compose-diaeresis-map [?\"]	[diaeresis])
-(define-key compose-diaeresis-map [A]	[Adiaeresis])
-(define-key compose-diaeresis-map [E]	[Ediaeresis])
-(define-key compose-diaeresis-map [I]	[Idiaeresis])
-(define-key compose-diaeresis-map [O]	[Odiaeresis])
-(define-key compose-diaeresis-map [U]	[Udiaeresis])
-(define-key compose-diaeresis-map [a]	[adiaeresis])
-(define-key compose-diaeresis-map [e]	[ediaeresis])
-(define-key compose-diaeresis-map [i]	[idiaeresis])
-(define-key compose-diaeresis-map [o]	[odiaeresis])
-(define-key compose-diaeresis-map [u]	[udiaeresis])
-(define-key compose-diaeresis-map [y]	[ydiaeresis])
+(define-key compose-diaeresis-map [space] [(?\250)])
+(define-key compose-diaeresis-map [?\"]	[(?\250)])
+(define-key compose-diaeresis-map [A]	[(?\304)])
+(define-key compose-diaeresis-map [E]	[(?\313)])
+(define-key compose-diaeresis-map [I]	[(?\317)])
+(define-key compose-diaeresis-map [O]	[(?\326)])
+(define-key compose-diaeresis-map [U]	[(?\334)])
+(define-key compose-diaeresis-map [a]	[(?\344)])
+(define-key compose-diaeresis-map [e]	[(?\353)])
+(define-key compose-diaeresis-map [i]	[(?\357)])
+(define-key compose-diaeresis-map [o]	[(?\366)])
+(define-key compose-diaeresis-map [u]	[(?\374)])
+(define-key compose-diaeresis-map [y]	[(?\377)])
 
 (define-key compose-circumflex-map [space] "^")
 (define-key compose-circumflex-map [?/]	"|")
-(define-key compose-circumflex-map [?!]	[brokenbar])
-(define-key compose-circumflex-map [?-]	[macron])
-(define-key compose-circumflex-map [?_]	[macron])
-(define-key compose-circumflex-map [?0]	[degree])
-(define-key compose-circumflex-map [?1]	[onesuperior])
-(define-key compose-circumflex-map [?2]	[twosuperior])
-(define-key compose-circumflex-map [?3]	[threesuperior])
-(define-key compose-circumflex-map [?.]	[periodcentered])
-(define-key compose-circumflex-map [A]	[Acircumflex])
-(define-key compose-circumflex-map [E]	[Ecircumflex])
-(define-key compose-circumflex-map [I]	[Icircumflex])
-(define-key compose-circumflex-map [O]	[Ocircumflex])
-(define-key compose-circumflex-map [U]	[Ucircumflex])
-(define-key compose-circumflex-map [a]	[acircumflex])
-(define-key compose-circumflex-map [e]	[ecircumflex])
-(define-key compose-circumflex-map [i]	[icircumflex])
-(define-key compose-circumflex-map [o]	[ocircumflex])
-(define-key compose-circumflex-map [u]	[ucircumflex])
+(define-key compose-circumflex-map [?!]	[(?\246)])
+(define-key compose-circumflex-map [?-]	[(?\257)])
+(define-key compose-circumflex-map [?_]	[(?\257)])
+(define-key compose-circumflex-map [?0]	[(?\260)])
+(define-key compose-circumflex-map [?1]	[(?\271)])
+(define-key compose-circumflex-map [?2]	[(?\262)])
+(define-key compose-circumflex-map [?3]	[(?\263)])
+(define-key compose-circumflex-map [?.]	[(?\267)])
+(define-key compose-circumflex-map [A]	[(?\302)])
+(define-key compose-circumflex-map [E]	[(?\312)])
+(define-key compose-circumflex-map [I]	[(?\316)])
+(define-key compose-circumflex-map [O]	[(?\324)])
+(define-key compose-circumflex-map [U]	[(?\333)])
+(define-key compose-circumflex-map [a]	[(?\342)])
+(define-key compose-circumflex-map [e]	[(?\352)])
+(define-key compose-circumflex-map [i]	[(?\356)])
+(define-key compose-circumflex-map [o]	[(?\364)])
+(define-key compose-circumflex-map [u]	[(?\373)])
 
 (define-key compose-tilde-map [space]	"~")
-(define-key compose-tilde-map [A]	[Atilde])
-(define-key compose-tilde-map [N]	[Ntilde])
-(define-key compose-tilde-map [O]	[Otilde])
-(define-key compose-tilde-map [a]	[atilde])
-(define-key compose-tilde-map [n]	[ntilde])
-(define-key compose-tilde-map [o]	[otilde])
+(define-key compose-tilde-map [A]	[(?\303)])
+(define-key compose-tilde-map [N]	[(?\321)])
+(define-key compose-tilde-map [O]	[(?\325)])
+(define-key compose-tilde-map [a]	[(?\343)])
+(define-key compose-tilde-map [n]	[(?\361)])
+(define-key compose-tilde-map [o]	[(?\365)])
 
-(define-key compose-ring-map [space]	[degree])
-(define-key compose-ring-map [A]	[Aring])
-(define-key compose-ring-map [a]	[aring])
+(define-key compose-ring-map [space]	[(?\260)])
+(define-key compose-ring-map [A]	[(?\305)])
+(define-key compose-ring-map [a]	[(?\345)])
 
 
 ;;; The rest of the compose-map.  These are the composed characters
@@ -245,17 +275,17 @@
 (define-key compose-map " ^"	"^")
 (define-key compose-map " `"	"`")
 (define-key compose-map " ~"	"~")
-(define-key compose-map "  "	[nobreakspace])
-(define-key compose-map " \""	[diaeresis])
-(define-key compose-map " :"	[diaeresis])
-(define-key compose-map " *"	[degree])
+(define-key compose-map "  "	[(?\240)])
+(define-key compose-map " \""	[(?\250)])
+(define-key compose-map " :"	[(?\250)])
+(define-key compose-map " *"	[(?\260)])
 
-(define-key compose-map "!!"	[exclamdown])
-(define-key compose-map "!^"	[brokenbar])
-(define-key compose-map "!S"	[section])
-(define-key compose-map "!s"	[section])
-(define-key compose-map "!P"	[paragraph])
-(define-key compose-map "!p"	[paragraph])
+(define-key compose-map "!!"	[(?\241)])
+(define-key compose-map "!^"	[(?\246)])
+(define-key compose-map "!S"	[(?\247)])
+(define-key compose-map "!s"	[(?\247)])
+(define-key compose-map "!P"	[(?\266)])
+(define-key compose-map "!p"	[(?\266)])
 
 (define-key compose-map "(("	"[")
 (define-key compose-map "(-"	"{")
@@ -264,242 +294,242 @@
 (define-key compose-map ")-"	"}")
 
 (define-key compose-map "++"	"#")
-(define-key compose-map "+-"	[plusminus])
+(define-key compose-map "+-"	[(?\261)])
 
 (define-key compose-map "-("	"{")
 (define-key compose-map "-)"	"}")
 (define-key compose-map "--"	"-")
-(define-key compose-map "-L"	[sterling])
-(define-key compose-map "-l"	[sterling])
-(define-key compose-map "-Y"	[yen])
-(define-key compose-map "-y"	[yen])
-(define-key compose-map "-,"	[notsign])
-(define-key compose-map "-|"	[notsign])
-(define-key compose-map "-^"	[macron])
-(define-key compose-map "-+"	[plusminus])
-(define-key compose-map "-:"	[division])
-(define-key compose-map "-D"	[ETH])
-(define-key compose-map "-d"	[eth])
-(define-key compose-map "-a"    [ordfeminine])
+(define-key compose-map "-L"	[(?\243)])
+(define-key compose-map "-l"	[(?\243)])
+(define-key compose-map "-Y"	[(?\245)])
+(define-key compose-map "-y"	[(?\245)])
+(define-key compose-map "-,"	[(?\254)])
+(define-key compose-map "-|"	[(?\254)])
+(define-key compose-map "-^"	[(?\257)])
+(define-key compose-map "-+"	[(?\261)])
+(define-key compose-map "-:"	[(?\367)])
+(define-key compose-map "-D"	[(?\320)])
+(define-key compose-map "-d"	[(?\360)])
+(define-key compose-map "-a"    [(?\252)])
 
-(define-key compose-map ".^"	[periodcentered])
+(define-key compose-map ".^"	[(?\267)])
 
 (define-key compose-map "//"	"\\")
 (define-key compose-map "/<"	"\\")
 (define-key compose-map "/^"	"|")
-(define-key compose-map "/C"	[cent])
-(define-key compose-map "/c"	[cent])
-(define-key compose-map "/U"	[mu])
-(define-key compose-map "/u"	[mu])
-(define-key compose-map "/O"	[Ooblique])
-(define-key compose-map "/o"	[oslash])
+(define-key compose-map "/C"	[(?\242)])
+(define-key compose-map "/c"	[(?\242)])
+(define-key compose-map "/U"	[(?\265)])
+(define-key compose-map "/u"	[(?\265)])
+(define-key compose-map "/O"	[(?\330)])
+(define-key compose-map "/o"	[(?\370)])
 
-(define-key compose-map "0X"	[currency])
-(define-key compose-map "0x"	[currency])
-(define-key compose-map "0S"	[section])
-(define-key compose-map "0s"	[section])
-(define-key compose-map "0C"	[copyright])
-(define-key compose-map "0c"	[copyright])
-(define-key compose-map "0R"	[registered])
-(define-key compose-map "0r"	[registered])
-(define-key compose-map "0^"	[degree])
+(define-key compose-map "0X"	[(?\244)])
+(define-key compose-map "0x"	[(?\244)])
+(define-key compose-map "0S"	[(?\247)])
+(define-key compose-map "0s"	[(?\247)])
+(define-key compose-map "0C"	[(?\251)])
+(define-key compose-map "0c"	[(?\251)])
+(define-key compose-map "0R"	[(?\256)])
+(define-key compose-map "0r"	[(?\256)])
+(define-key compose-map "0^"	[(?\260)])
 
-(define-key compose-map "1^"	[onesuperior])
-(define-key compose-map "14"	[onequarter])
-(define-key compose-map "12"	[onehalf])
+(define-key compose-map "1^"	[(?\271)])
+(define-key compose-map "14"	[(?\274)])
+(define-key compose-map "12"	[(?\275)])
 
-(define-key compose-map "2^"	[twosuperior])
+(define-key compose-map "2^"	[(?\262)])
 
-(define-key compose-map "3^"	[threesuperior])
-(define-key compose-map "34"	[threequarters])
+(define-key compose-map "3^"	[(?\263)])
+(define-key compose-map "34"	[(?\276)])
 
-(define-key compose-map ":-"	[division])
+(define-key compose-map ":-"	[(?\367)])
 
 (define-key compose-map "</"	"\\")
-(define-key compose-map "<<"	[guillemotleft])
+(define-key compose-map "<<"	[(?\253)])
 
-(define-key compose-map "=L"	[sterling])
-(define-key compose-map "=l"	[sterling])
-(define-key compose-map "=Y"	[yen])
-(define-key compose-map "=y"	[yen])
+(define-key compose-map "=L"	[(?\243)])
+(define-key compose-map "=l"	[(?\243)])
+(define-key compose-map "=Y"	[(?\245)])
+(define-key compose-map "=y"	[(?\245)])
 
-(define-key compose-map ">>"	[guillemotright])
+(define-key compose-map ">>"	[(?\273)])
 
-(define-key compose-map "??"	[questiondown])
+(define-key compose-map "??"	[(?\277)])
 
 (define-key compose-map "AA"	"@")
 (define-key compose-map "Aa"	"@")
-(define-key compose-map "A_"	[ordfeminine])
-(define-key compose-map "A`"	[Agrave])
-(define-key compose-map "A'"	[Aacute])
-(define-key compose-map "A^"	[Acircumflex])
-(define-key compose-map "A~"	[Atilde])
-(define-key compose-map "A\""	[Adiaeresis])
-(define-key compose-map "A*"	[Aring])
-(define-key compose-map "AE"	[AE])
+(define-key compose-map "A_"	[(?\252)])
+(define-key compose-map "A`"	[(?\300)])
+(define-key compose-map "A'"	[(?\301)])
+(define-key compose-map "A^"	[(?\302)])
+(define-key compose-map "A~"	[(?\303)])
+(define-key compose-map "A\""	[(?\304)])
+(define-key compose-map "A*"	[(?\305)])
+(define-key compose-map "AE"	[(?\306)])
 
-(define-key compose-map "C/"	[cent])
-(define-key compose-map "C|"	[cent])
-(define-key compose-map "C0"	[copyright])
-(define-key compose-map "CO"	[copyright])
-(define-key compose-map "Co"	[copyright])
-(define-key compose-map "C,"	[Ccedilla])
+(define-key compose-map "C/"	[(?\242)])
+(define-key compose-map "C|"	[(?\242)])
+(define-key compose-map "C0"	[(?\251)])
+(define-key compose-map "CO"	[(?\251)])
+(define-key compose-map "Co"	[(?\251)])
+(define-key compose-map "C,"	[(?\307)])
 
-(define-key compose-map "D-"	[ETH])
+(define-key compose-map "D-"	[(?\320)])
 
-(define-key compose-map "E`"	[Egrave])
-(define-key compose-map "E'"	[Eacute])
-(define-key compose-map "E^"	[Ecircumflex])
-(define-key compose-map "E\""	[Ediaeresis])
+(define-key compose-map "E`"	[(?\310)])
+(define-key compose-map "E'"	[(?\311)])
+(define-key compose-map "E^"	[(?\312)])
+(define-key compose-map "E\""	[(?\313)])
 
-(define-key compose-map "I`"	[Igrave])
-(define-key compose-map "I'"	[Iacute])
-(define-key compose-map "I^"	[Icircumflex])
-(define-key compose-map "I\""	[Idiaeresis])
+(define-key compose-map "I`"	[(?\314)])
+(define-key compose-map "I'"	[(?\315)])
+(define-key compose-map "I^"	[(?\316)])
+(define-key compose-map "I\""	[(?\317)])
 
-(define-key compose-map "L-"	[sterling])
-(define-key compose-map "L="	[sterling])
+(define-key compose-map "L-"	[(?\243)])
+(define-key compose-map "L="	[(?\243)])
 
-(define-key compose-map "N~"	[Ntilde])
+(define-key compose-map "N~"	[(?\321)])
 
-(define-key compose-map "OX"	[currency])
-(define-key compose-map "Ox"	[currency])
-(define-key compose-map "OS"	[section])
-(define-key compose-map "Os"	[section])
-(define-key compose-map "OC"	[copyright])
-(define-key compose-map "Oc"	[copyright])
-(define-key compose-map "OR"	[registered])
-(define-key compose-map "Or"	[registered])
-(define-key compose-map "O_"	[masculine])
-(define-key compose-map "O`"	[Ograve])
-(define-key compose-map "O'"	[Oacute])
-(define-key compose-map "O^"	[Ocircumflex])
-(define-key compose-map "O~"	[Otilde])
-(define-key compose-map "O\""	[Odiaeresis])
-(define-key compose-map "O/"	[Ooblique])
+(define-key compose-map "OX"	[(?\244)])
+(define-key compose-map "Ox"	[(?\244)])
+(define-key compose-map "OS"	[(?\247)])
+(define-key compose-map "Os"	[(?\247)])
+(define-key compose-map "OC"	[(?\251)])
+(define-key compose-map "Oc"	[(?\251)])
+(define-key compose-map "OR"	[(?\256)])
+(define-key compose-map "Or"	[(?\256)])
+(define-key compose-map "O_"	[(?\272)])
+(define-key compose-map "O`"	[(?\322)])
+(define-key compose-map "O'"	[(?\323)])
+(define-key compose-map "O^"	[(?\324)])
+(define-key compose-map "O~"	[(?\325)])
+(define-key compose-map "O\""	[(?\326)])
+(define-key compose-map "O/"	[(?\330)])
 
-(define-key compose-map "P!"	[paragraph])
+(define-key compose-map "P!"	[(?\266)])
 
-(define-key compose-map "R0"	[registered])
-(define-key compose-map "RO"	[registered])
-(define-key compose-map "Ro"	[registered])
+(define-key compose-map "R0"	[(?\256)])
+(define-key compose-map "RO"	[(?\256)])
+(define-key compose-map "Ro"	[(?\256)])
 
-(define-key compose-map "S!"	[section])
-(define-key compose-map "S0"	[section])
-(define-key compose-map "SO"	[section])
-(define-key compose-map "So"	[section])
-(define-key compose-map "SS"	[ssharp])
+(define-key compose-map "S!"	[(?\247)])
+(define-key compose-map "S0"	[(?\247)])
+(define-key compose-map "SO"	[(?\247)])
+(define-key compose-map "So"	[(?\247)])
+(define-key compose-map "SS"	[(?\337)])
 
-(define-key compose-map "TH"	[THORN])
+(define-key compose-map "TH"	[(?\336)])
 
-(define-key compose-map "U`"	[Ugrave])
-(define-key compose-map "U'"	[Uacute])
-(define-key compose-map "U^"	[Ucircumflex])
-(define-key compose-map "U\""	[Udiaeresis])
+(define-key compose-map "U`"	[(?\331)])
+(define-key compose-map "U'"	[(?\332)])
+(define-key compose-map "U^"	[(?\333)])
+(define-key compose-map "U\""	[(?\334)])
 
-(define-key compose-map "X0"	[currency])
-(define-key compose-map "XO"	[currency])
-(define-key compose-map "Xo"	[currency])
+(define-key compose-map "X0"	[(?\244)])
+(define-key compose-map "XO"	[(?\244)])
+(define-key compose-map "Xo"	[(?\244)])
 
-(define-key compose-map "Y-"	[yen])
-(define-key compose-map "Y="	[yen])
-(define-key compose-map "Y'"	[Yacute])
+(define-key compose-map "Y-"	[(?\245)])
+(define-key compose-map "Y="	[(?\245)])
+(define-key compose-map "Y'"	[(?\335)])
 
-(define-key compose-map "_A"	[ordfeminine])
-(define-key compose-map "_a"	[ordfeminine])
-(define-key compose-map "_^"	[macron])
-(define-key compose-map "_O"	[masculine])
-(define-key compose-map "_o"	[masculine])
+(define-key compose-map "_A"	[(?\252)])
+(define-key compose-map "_a"	[(?\252)])
+(define-key compose-map "_^"	[(?\257)])
+(define-key compose-map "_O"	[(?\272)])
+(define-key compose-map "_o"	[(?\272)])
 
 (define-key compose-map "aA"	"@")
 (define-key compose-map "aa"	"@")
-(define-key compose-map "a_"	[ordfeminine])
-(define-key compose-map "a-"    [ordfeminine])
-(define-key compose-map "a`"	[agrave])
-(define-key compose-map "a'"	[aacute])
-(define-key compose-map "a^"	[acircumflex])
-(define-key compose-map "a~"	[atilde])
-(define-key compose-map "a\""	[adiaeresis])
-(define-key compose-map "a*"	[aring])
-(define-key compose-map "ae"	[ae])
+(define-key compose-map "a_"	[(?\252)])
+(define-key compose-map "a-"    [(?\252)])
+(define-key compose-map "a`"	[(?\340)])
+(define-key compose-map "a'"	[(?\341)])
+(define-key compose-map "a^"	[(?\342)])
+(define-key compose-map "a~"	[(?\343)])
+(define-key compose-map "a\""	[(?\344)])
+(define-key compose-map "a*"	[(?\345)])
+(define-key compose-map "ae"	[(?\346)])
 
-(define-key compose-map "c/"	[cent])
-(define-key compose-map "c|"	[cent])
-(define-key compose-map "c0"	[copyright])
-(define-key compose-map "cO"	[copyright])
-(define-key compose-map "co"	[copyright])
-(define-key compose-map "c,"	[ccedilla])
+(define-key compose-map "c/"	[(?\242)])
+(define-key compose-map "c|"	[(?\242)])
+(define-key compose-map "c0"	[(?\251)])
+(define-key compose-map "cO"	[(?\251)])
+(define-key compose-map "co"	[(?\251)])
+(define-key compose-map "c,"	[(?\347)])
 
-(define-key compose-map "d-"	[eth])
+(define-key compose-map "d-"	[(?\360)])
 
-(define-key compose-map "e`"	[egrave])
-(define-key compose-map "e'"	[eacute])
-(define-key compose-map "e^"	[ecircumflex])
-(define-key compose-map "e\""	[ediaeresis])
+(define-key compose-map "e`"	[(?\350)])
+(define-key compose-map "e'"	[(?\351)])
+(define-key compose-map "e^"	[(?\352)])
+(define-key compose-map "e\""	[(?\353)])
 
-(define-key compose-map "i`"	[igrave])
-(define-key compose-map "i'"	[iacute])
-(define-key compose-map "i^"	[icircumflex])
-(define-key compose-map "i\""	[idiaeresis])
-(define-key compose-map "i:"	[idiaeresis])
+(define-key compose-map "i`"	[(?\354)])
+(define-key compose-map "i'"	[(?\355)])
+(define-key compose-map "i^"	[(?\356)])
+(define-key compose-map "i\""	[(?\357)])
+(define-key compose-map "i:"	[(?\357)])
 
-(define-key compose-map "l-"	[sterling])
-(define-key compose-map "l="	[sterling])
+(define-key compose-map "l-"	[(?\243)])
+(define-key compose-map "l="	[(?\243)])
 
-(define-key compose-map "n~"	[ntilde])
+(define-key compose-map "n~"	[(?\361)])
 
-(define-key compose-map "oX"	[currency])
-(define-key compose-map "ox"	[currency])
-(define-key compose-map "oC"	[copyright])
-(define-key compose-map "oc"	[copyright])
-(define-key compose-map "oR"	[registered])
-(define-key compose-map "or"	[registered])
-(define-key compose-map "oS"	[section])
-(define-key compose-map "os"	[section])
-(define-key compose-map "o_"	[masculine])
-(define-key compose-map "o`"	[ograve])
-(define-key compose-map "o'"	[oacute])
-(define-key compose-map "o^"	[ocircumflex])
-(define-key compose-map "o~"	[otilde])
-(define-key compose-map "o\""	[odiaeresis])
-(define-key compose-map "o/"	[oslash])
+(define-key compose-map "oX"	[(?\244)])
+(define-key compose-map "ox"	[(?\244)])
+(define-key compose-map "oC"	[(?\251)])
+(define-key compose-map "oc"	[(?\251)])
+(define-key compose-map "oR"	[(?\256)])
+(define-key compose-map "or"	[(?\256)])
+(define-key compose-map "oS"	[(?\247)])
+(define-key compose-map "os"	[(?\247)])
+(define-key compose-map "o_"	[(?\272)])
+(define-key compose-map "o`"	[(?\362)])
+(define-key compose-map "o'"	[(?\363)])
+(define-key compose-map "o^"	[(?\364)])
+(define-key compose-map "o~"	[(?\365)])
+(define-key compose-map "o\""	[(?\366)])
+(define-key compose-map "o/"	[(?\370)])
 
-(define-key compose-map "p!"	[paragraph])
+(define-key compose-map "p!"	[(?\266)])
 
-(define-key compose-map "r0"	[registered])
-(define-key compose-map "rO"	[registered])
-(define-key compose-map "ro"	[registered])
+(define-key compose-map "r0"	[(?\256)])
+(define-key compose-map "rO"	[(?\256)])
+(define-key compose-map "ro"	[(?\256)])
 
-(define-key compose-map "s!"	[section])
-(define-key compose-map "s0"	[section])
-(define-key compose-map "sO"	[section])
-(define-key compose-map "so"	[section])
-(define-key compose-map "ss"	[ssharp])
+(define-key compose-map "s!"	[(?\247)])
+(define-key compose-map "s0"	[(?\247)])
+(define-key compose-map "sO"	[(?\247)])
+(define-key compose-map "so"	[(?\247)])
+(define-key compose-map "ss"	[(?\337)])
 
-(define-key compose-map "th"	[thorn])
+(define-key compose-map "th"	[(?\376)])
 
-(define-key compose-map "u`"	[ugrave])
-(define-key compose-map "u'"	[uacute])
-(define-key compose-map "u^"	[ucircumflex])
-(define-key compose-map "u\""	[udiaeresis])
-(define-key compose-map "u/"	[mu])
+(define-key compose-map "u`"	[(?\371)])
+(define-key compose-map "u'"	[(?\372)])
+(define-key compose-map "u^"	[(?\373)])
+(define-key compose-map "u\""	[(?\374)])
+(define-key compose-map "u/"	[(?\265)])
 
-(define-key compose-map "x0"	[currency])
-(define-key compose-map "xO"	[currency])
-(define-key compose-map "xo"	[currency])
-(define-key compose-map "xx"	[multiply])
+(define-key compose-map "x0"	[(?\244)])
+(define-key compose-map "xO"	[(?\244)])
+(define-key compose-map "xo"	[(?\244)])
+(define-key compose-map "xx"	[(?\327)])
 
-(define-key compose-map "y-"	[yen])
-(define-key compose-map "y="	[yen])
-(define-key compose-map "y'"	[yacute])
-(define-key compose-map "y\""	[ydiaeresis])
+(define-key compose-map "y-"	[(?\245)])
+(define-key compose-map "y="	[(?\245)])
+(define-key compose-map "y'"	[(?\375)])
+(define-key compose-map "y\""	[(?\377)])
 
-(define-key compose-map "|C"	[cent])
-(define-key compose-map "|c"	[cent])
-(define-key compose-map "||"	[brokenbar])
+(define-key compose-map "|C"	[(?\242)])
+(define-key compose-map "|c"	[(?\242)])
+(define-key compose-map "||"	[(?\246)])
 
 
-;; Suppose we type these three physical keys: [Multi_key " a]
+;; [[ Suppose we type these three physical keys: [Multi_key " a]
 ;; Xlib can deliver these keys as the following sequences of keysyms:
 ;;
 ;; - [Multi_key " a] (no surprise here)
@@ -510,20 +540,29 @@
 ;; decide whether it's really doing compose processing or not (or
 ;; actually, different parts of Xlib disagree).
 ;;
-;; So we'll just convert [Multi_key " adiaeresis] to [adiaeresis]
-(defun xlib-input-method-bug-workaround (keymap)
-  (map-keymap
-   (lambda (key value)
-     (cond
-      ((keymapp value)
-       (xlib-input-method-bug-workaround value))
-      ((and (sequencep value)
-	    (eq 1 (length value))
-	    (null (lookup-key keymap value)))
-       (define-key keymap value value))))
-   keymap))
-(xlib-input-method-bug-workaround compose-map)
-(unintern 'xlib-input-method-bug-workaround)
+;; So we'll just convert [Multi_key " adiaeresis] to [adiaeresis] ]] 
+
+(eval-when-compile 
+  (when nil ;; Commenting out.
+
+    ;; This _used_ to work with our X11-oriented keysyms above. With them
+    ;; gone, it won't. The X11 bug it works around should be long dead. (Ha! 
+    ;; Wasn't it cockroaches that would have ruled the planet after World
+    ;; War III?)
+
+    (defun xlib-input-method-bug-workaround (keymap)
+      (map-keymap
+       (lambda (key value)
+	 (cond
+	  ((keymapp value)
+	   (xlib-input-method-bug-workaround value))
+	  ((and (sequencep value)
+		(eq 1 (length value))
+		(null (lookup-key keymap value)))
+	   (define-key keymap value value))))
+       keymap))
+    (xlib-input-method-bug-workaround compose-map)
+    (unintern 'xlib-input-method-bug-workaround)))
 
 ;; While we're at it, a similar mechanism will make colon equivalent
 ;; to doublequote for diaeresis processing.  Some Xlibs do this.
@@ -582,7 +621,7 @@
       (if (and (vectorp mod-char) (= (length mod-char) 1))
 	  (setq mod-char (aref mod-char 0)))
       (if (and mod-char (symbolp mod-char))
-	  (setq mod-char (or (get mod-char character-set-property) mod-char)))
+	  (setq mod-char (or (get mod-char 'character-of-keysym) mod-char)))
       (if (and mod-char (> count 0))
 	  (delete-char -1)
 	(setq mod-char c))
@@ -655,8 +694,8 @@
 
 (defun compose-help-mapper (key binding)
   (if (and (symbolp key)
-	   (get key character-set-property))
-      (setq key (get key character-set-property)))
+	   (get key 'character-of-keysym))
+      (setq key (get key 'character-of-keysym)))
   (if (eq binding 'compose-help) ; suppress that...
       nil
     (if (keymapp binding)
@@ -675,7 +714,7 @@
       (indent-to 16)
       (let ((code (and (vectorp binding)
 		       (= 1 (length binding))
-		       (get (aref binding 0) character-set-property))))
+		       (get (aref binding 0) 'character-of-keysym))))
 	(if code
 	    (insert (make-string 1 code))
 	  (if (stringp binding)
--- a/lisp/x-init.el	Sat Jun 25 21:51:12 2005 +0000
+++ b/lisp/x-init.el	Sun Jun 26 18:05:05 2005 +0000
@@ -192,7 +192,11 @@
   (x-define-dead-key XK_mute_asciicircum	compose-circumflex-map)
   (x-define-dead-key XK_mute_asciitilde		compose-tilde-map)
 
-  ;; Xfree86 seems to use lower case and a hyphen
+  ;; [[ XFree86 seems to use lower case and a hyphen ]] Not true; they use
+  ;; lower case and an underscore. XEmacs converts the underscore to a
+  ;; hyphen in x_keysym_to_emacs_keysym because the keysym is in the
+  ;; "Keyboard" character set, which is just totally fucking random,
+  ;; considering it doesn't happen for any other character sets. 
   (x-define-dead-key dead-acute			compose-acute-map)
   (x-define-dead-key dead-grave			compose-grave-map)
   (x-define-dead-key dead-cedilla		compose-cedilla-map)
@@ -240,7 +244,7 @@
   (let (unknown-code-points sym-string)
     (dolist (x-keysym (hash-table-key-list (x-keysym-hash-table)))
       (setq sym-string (if (stringp x-keysym) x-keysym (symbol-name x-keysym)))
-      (when (and (not (get (intern sym-string) 'ascii-character))
+      (when (and (not (get (intern sym-string) 'character-of-keysym))
 		 (string-match "^U[0-9A-F]+$" sym-string))
 	(pushnew (concat sym-string " ") unknown-code-points :test 'equal)))
     (when unknown-code-points
@@ -288,9 +292,6 @@
 (defun init-pre-x-win ()
   "Initialize X Windows at startup (pre).  Don't call this."
   (when (not pre-x-win-initted)
-    (require 'x-iso8859-1)
-    (setq character-set-property 'x-iso8859/1) ; see x-iso8859-1.el
-
     (setq initial-frame-plist (if initial-frame-unmapped-p
                                   '(initially-unmapped t)
                                 nil))
--- a/man/ChangeLog	Sat Jun 25 21:51:12 2005 +0000
+++ b/man/ChangeLog	Sun Jun 26 18:05:05 2005 +0000
@@ -1,3 +1,14 @@
+2005-06-26  Aidan Kehoe  <kehoea@parhasard.net>
+
+	* lispref/commands.texi (Converting Events): 
+	* lispref/keymaps.texi (Key Sequences):
+	Stop pretending ASCII is an eight-bit character set, and remove
+	documentation of event-to-character's vanished fourth argument.
+
+	* internals/internals.texi (Old Future Work -- Improvements in
+	support for non-ASCII (European) keysyms under X):
+	Rename the ascii-character property. 
+	
 2005-06-19  Aidan Kehoe  <kehoea@parhasard.net>
 
 	* lispref/building.texi (Building XEmacs and Object Allocation):
--- a/man/internals/internals.texi	Sat Jun 25 21:51:12 2005 +0000
+++ b/man/internals/internals.texi	Sun Jun 26 18:05:05 2005 +0000
@@ -28257,7 +28257,7 @@
 
 @quotation
    For every key on the keyboard that has a known character correspondence,
-   we define the ascii-character property of the keysym, and make the
+   we define the character-of-keysym property of the keysym, and make the
    default binding for the key be self-insert-command.
 
    The following magic is basically intimate knowledge of X11/keysymdef.h.
--- a/man/lispref/commands.texi	Sat Jun 25 21:51:12 2005 +0000
+++ b/man/lispref/commands.texi	Sun Jun 26 18:05:05 2005 +0000
@@ -1482,11 +1482,11 @@
 
 Beware that @code{character-to-event} and @code{event-to-character} are
 not strictly inverse functions, since events contain much more
-information than the @sc{ascii} character set can encode.
+information than the XEmacs internal character encoding can store.
 @end defun
 
-@defun event-to-character event &optional allow-extra-modifiers allow-meta allow-non-ascii
-This function returns the closest @sc{ascii} approximation to
+@defun event-to-character event &optional allow-extra-modifiers allow-meta
+This function returns the closest character approximation to
 @var{event}.  If the event isn't a keypress, this returns @code{nil}.
 
 If @var{allow-extra-modifiers} is non-@code{nil}, then this is lenient
@@ -1501,15 +1501,9 @@
 otherwise, @code{nil} will be returned for events containing the
 @key{Meta} modifier.
 
-If @var{allow-non-ascii} is non-@code{nil}, then characters which are
-present in the prevailing character set (@pxref{Keymaps, variable
-@code{character-set-property}}) will be returned as their code in that
-character set, instead of the return value being restricted to
-@sc{ascii}.
-
-Note that specifying both @var{allow-meta} and @var{allow-non-ascii} is
-ambiguous, as both use the high bit; @key{M-x} and @key{oslash} will be
-indistinguishable.
+Specifying @var{allow-meta} will give ambiguous results---@key{M-x} and
+@key{oslash} will return the same thing, for example---so you should
+probably not use it.
 @end defun
 
 @defun events-to-keys events &optional no-mice
--- a/man/lispref/keymaps.texi	Sat Jun 25 21:51:12 2005 +0000
+++ b/man/lispref/keymaps.texi	Sun Jun 26 18:05:05 2005 +0000
@@ -245,12 +245,22 @@
 keysym and some set of modifiers (such as @key{CONTROL} and @key{META}).
 A @dfn{keysym} is what is printed on the keys on your keyboard.
 
-  A keysym may be represented by a symbol, or (if and only if it is
-equivalent to an @sc{ascii} character in the range 32 - 255) by a
-character or its equivalent @sc{ascii} code.  The @kbd{A} key may be
-represented by the symbol @code{A}, the character @code{?A}, or by the
-number 65.  The @kbd{break} key may be represented only by the symbol
-@code{break}.
+  A keysym may be represented by a symbol, by a character, or by a
+character's Mule code. The @kbd{A} key may be represented by the symbol
+@code{A}, the character @code{?A}, or by the number 65.  The @kbd{break}
+key may be represented only by the symbol @code{break}, and non-ASCII
+X11 keys in general are limited to the symbol form with XEmacs.
+@footnote{A quirk of our X11 implementation means that non-ASCII keysyms
+have different internal representations in the X11 (with GTK) and other
+worlds (like the TTY, or Microsoft Windows), so, for example, binding
+@kbd{EuroSign} to a command will normally work, but will not invoke that
+command if someone presses the Euro sign in a TTY console; conversely,
+binding @code{(make-char 'latin-iso8859-15 #xa4)} or @code{(char-to-int
+(make-char 'latin-iso8859-15 #xa4))} to a command will call that command
+on a TTY console, but not in an X11 window of the same process.}
+@footnote{See the documentation for `set-input-mode' and
+`set-console-tty-coding-system' if you're having trouble inputting
+non-ASCII characters in the TTY.}
 
   A keystroke may be represented by a list: the last element of the list
 is the key (a symbol, character, or number, as above) and the preceding
--- a/src/ChangeLog	Sat Jun 25 21:51:12 2005 +0000
+++ b/src/ChangeLog	Sun Jun 26 18:05:05 2005 +0000
@@ -1,3 +1,112 @@
+2005-06-26  Aidan Kehoe  <kehoea@parhasard.net>
+
+	* cmds.c (Fself_insert_command):
+	No 4th arg to event_to_character. 
+
+	* console-impl.h (struct console_methods): Add a new member
+	method, perhaps_init_unseen_key_defaults, which is to allow the
+	console to take appropriate action--often a default binding to
+	self-insert-command--when notified about a character it may not
+	have seen before. 
+	
+	* console-gtk.c:
+	Add gtk_perhaps_init_unseen_key_defaults, a new console method,
+	and a hash table it uses. 
+
+	* console-msw.c:
+	Add mswindows_perhaps_init_unseen_key_defaults, a new console
+	method, and a hash table it uses. 
+	
+	* console-tty.c:
+	Add tty_perhaps_init_unseen_key_defaults, a new console method,
+	and a hash table used by it. 
+
+	* console-x.c:
+	* console-x.c (x_perhaps_init_unseen_key_defaults): New. 
+	Given a key, if it maps to a character and we weren't previously
+	aware that it could be generated on console CON, and if it's
+	unbound in the global map, bind it to self-insert-command. Return
+	Qt if the binding was done; Qnil if not.
+	
+	* device-gtk.c:
+	* device-gtk.c (vars_of_device_gtk):
+	Add a hash table var used by gtk_perhaps_init_unseen_key_defaults.
+
+	* editfns.c (Fchar_to_string):
+	Call Fevent_to_character with three arguments, not four; don't
+	express a belief that the only XEmacs character encoding is
+	ASCII. 
+	
+	* event-Xt.c:
+	* event-Xt.c (maybe_define_x_key_as_self_inserting_character):
+	ascii-character -> character-of-keysym property renaming. 
+	
+	* event-Xt.c (x_has_keysym):
+	Make it visible to the console code, make it a little more Mule-safe. 
+	
+	* event-Xt.c (index_to_name):
+	Move to Mule declaration conventions. 
+
+	* event-Xt.c (x_reset_modifier_mapping):
+	Move large comment from Jamie before this function. 
+
+	* event-Xt.c (x_keysym_to_emacs_keysym):
+	Move to Mule declaration conventions and coding practices. 
+	
+	* event-Xt.c (x_event_to_emacs_event):
+	Add some comments, and the initial steps necessary for Russian C-x
+	support. 
+
+	* event-msw.c (mswindows_wnd_proc):
+	Don't conditionalize Russian C-x support on Mule. (I'm not certain
+	if this is correct on MSW, but it's the approach I'm taking on
+	X11.)
+	
+	* event-stream.c:
+	Add Russian C-x support, a var to enable and disable it, remove
+	composed-character-default-binding in favour of
+	self-insert-command, rename
+	command_builder_find_leaf_no_mule_processing to
+	command_builder_find_leaf_no_jit_binding, change
+	command_builder_find_leaf to tell the console-specific code to
+	perhaps add a binding for keys its never seen before, and then
+	retry the lookup if it would otherwise fail.  
+
+	* event-stream.c (execute_command_event):
+	event-to-character has three arguments now, not four. 
+	
+	* event-stream.c (vars_of_event_stream):
+	Formatting clean up for inhibit-input-event-recoding. 
+	
+	* event-xlike-inc.c:
+	* event-xlike-inc.c (endif):
+	Move x_keysym_to_character here from event-Xt.c so it can be used
+	by GTK 1.0 as well; greatly expand it, to handle many more
+	characters than previously.
+
+	* events.c:
+	Rename the ascii-character property, remove
+	character-set-property, remove the now unused fourth argument to
+	event_to_character, ditto for the event-to-character, 
+
+	* events.h (enum alternative_key_chars):
+	* events.h (struct Lisp_Key_Data):
+	Russian C-x processing is no longer Mule specific. (Though I'm not
+	certain why a Russian speaker would be using a non-Mule build.)
+
+	* keymap.c:
+	* keymap.c (event_matches_key_specifier_p):
+	* keymap.c (map_keymap_sort_predicate):
+	* keymap.c (Ftext_char_description):
+	* keymap.c (elide_next_two_p):
+	* keymap.c (describe_map):
+	Rename ascii-character to character-of-keysym, stop pretending the
+	internal encoding of XEmacs is purely ASCII, 
+
+	* lisp.h:
+	* sysdep.c (tty_init_sys_modes_on_device):
+	One less argument to event-to-character. 
+
 2005-06-23  Marcus Crestani  <crestani@xemacs.org>
 
 	* dumper.c (pdump_load_finish): Use EMACS_INT for elt_count.
--- a/src/cmds.c	Sat Jun 25 21:51:12 2005 +0000
+++ b/src/cmds.c	Sun Jun 26 18:05:05 2005 +0000
@@ -339,11 +339,12 @@
   if (CHAR_OR_CHAR_INTP (Vlast_command_char))
     c = Vlast_command_char;
   else
-    c = Fevent_to_character (Vlast_command_event, Qnil, Qnil, Qt);
+    c = Fevent_to_character (Vlast_command_event, Qnil, Qnil);
 
   if (NILP (c))
-    invalid_operation ("Last typed character has no ASCII equivalent",
-		       Fcopy_event (Vlast_command_event, Qnil));
+    invalid_operation (
+	    "Last typed key has no character equivalent (that we know of)",
+	    Fcopy_event (Vlast_command_event, Qnil));
 
   CHECK_CHAR_COERCE_INT (c);
 
--- a/src/console-gtk.c	Sat Jun 25 21:51:12 2005 +0000
+++ b/src/console-gtk.c	Sun Jun 26 18:05:05 2005 +0000
@@ -32,6 +32,9 @@
 #include "process.h" /* canonicalize_host_name */
 #include "redisplay.h" /* for display_arg */
 
+#include "charset.h"
+#include "elhash.h"
+
 #include "console-gtk-impl.h"
 
 DEFINE_CONSOLE_TYPE (gtk);
@@ -112,6 +115,80 @@
   RETURN_UNGCPRO (connection);
 }
 
+extern Lisp_Object gtk_keysym_to_character(guint keysym);
+
+static Lisp_Object
+gtk_perhaps_init_unseen_key_defaults (struct console *UNUSED(con),
+				      Lisp_Object key)
+{
+  Lisp_Object char_to_associate = Qnil;
+  extern Lisp_Object Vcurrent_global_map, Qgtk_seen_characters,
+    Qcharacter_of_keysym;
+
+  if (SYMBOLP(key))
+    {
+      gchar *symbol_name;
+      guint keyval;
+      DECLARE_EISTRING(ei_symname);
+      
+      eicpy_rawz(ei_symname, XSTRING_DATA(symbol_name(XSYMBOL(key))));
+
+      /* No information on the coding system of the string key names in GDK,
+	 to my knowledge. Defaulting to binary, */
+      eito_external(ei_symname, Qbinary);
+      symbol_name = eiextdata(ei_symname);
+
+/* GTK 2.0 has an API we can use, and makes this available in gdkkeys.h
+
+   This has yet to be compiled, because XEmacs' GTK support hasn't yet moved
+   to 2.0. So if you're porting XEmacs to GTK 2.0, bear that in mind. */
+      char_to_associate 
+#ifdef __GDK_KEYS_H__ 
+	= Funicode_to_char
+	      (make_int(gdk_keyval_to_unicode
+			(gdk_keyval_from_name(symbol_name))), Qnil);
+#else /* GTK 1.whatever doesn't. Use the X11 map. */
+        = gtk_keysym_to_character(gdk_keyval_from_name(symbol_name));
+#endif
+    }
+  else
+    {
+      CHECK_CHAR(key);
+    }
+
+  if (!(HASH_TABLEP(Qgtk_seen_characters)))
+    {
+      Qgtk_seen_characters = make_lisp_hash_table (128, HASH_TABLE_NON_WEAK,
+						   HASH_TABLE_EQUAL);
+    }
+
+  /* Might give the user an opaque error if make_lisp_hash_table fails,
+     but it shouldn't crash. */
+  CHECK_HASH_TABLE(Qgtk_seen_characters);
+
+  if (EQ(char_to_associate, Qnil) /* If there's no char to bind,  */
+      || (XCHAR(char_to_associate) < 0x80) /* or it's ASCII */
+      || !NILP(Fgethash(key, Qgtk_seen_characters, Qnil))) /* Or we've seen
+							      it already, */
+    {
+      /* then don't bind the key. */
+      return Qnil;
+    }
+
+  if (NILP (Flookup_key (Vcurrent_global_map, key, Qnil))) 
+    {
+      Fputhash(key, Qt, Qgtk_seen_characters);
+      Fdefine_key (Vcurrent_global_map, key, Qself_insert_command); 
+      if (SYMBOLP(key))
+	{
+	  Fput (key, Qcharacter_of_keysym, char_to_associate);
+	}
+      return Qt; 
+    }
+
+  return Qnil;
+}
+
 void
 console_type_create_gtk (void)
 {
@@ -123,6 +200,7 @@
   CONSOLE_HAS_METHOD (gtk, canonicalize_device_connection);
   CONSOLE_HAS_METHOD (gtk, device_to_console_connection);
   CONSOLE_HAS_METHOD (gtk, initially_selected_for_input);
+  CONSOLE_HAS_METHOD (gtk, perhaps_init_unseen_key_defaults);
   /* CONSOLE_HAS_METHOD (gtk, delete_console); */
 }
 
--- a/src/console-impl.h	Sat Jun 25 21:51:12 2005 +0000
+++ b/src/console-impl.h	Sun Jun 26 18:05:05 2005 +0000
@@ -74,6 +74,8 @@
     (Lisp_Object connection, Error_Behavior errb);
   Lisp_Object (*device_to_console_connection_method)
     (Lisp_Object connection, Error_Behavior errb);
+  Lisp_Object (*perhaps_init_unseen_key_defaults_method)
+    (struct console *, Lisp_Object keysym);
 
   /* device methods */
   void (*init_device_method) (struct device *, Lisp_Object props);
--- a/src/console-msw.c	Sat Jun 25 21:51:12 2005 +0000
+++ b/src/console-msw.c	Sun Jun 26 18:05:05 2005 +0000
@@ -37,6 +37,7 @@
 #include "console-msw-impl.h"
 #include "events.h"
 #include "opaque.h"
+#include "elhash.h"
 
 DEFINE_CONSOLE_TYPE (mswindows);
 DEFINE_CONSOLE_TYPE (msprinter);
@@ -67,6 +68,7 @@
 Lisp_Object Qtopmost;
 Lisp_Object Qyesno;
 Lisp_Object Qyesnocancel;
+static Lisp_Object Qseen_characters = Qnil;
 
 /* Lisp_Object Qabort; */
 /* Lisp_Object Qcancel; */
@@ -184,6 +186,60 @@
   return mswindows_canonicalize_console_connection (connection, errb);
 }
 
+/* The actual console doesn't matter, because the global map is global. See
+   console-x.c for a corner case, though. */
+
+static Lisp_Object
+mswindows_perhaps_init_unseen_key_defaults (struct console *UNUSED(con),
+					    Lisp_Object key)
+{
+  Ichar val;
+  extern Lisp_Object Vcurrent_global_map;
+
+  if (SYMBOLP(key))
+    {
+      /* We've no idea what to default a symbol to on MS Windows, and most
+	 of the keys I'm aware of that have
+	 symbols--cf. event-msw.c--_shouldn't_ have associated chars. */
+      return Qnil;
+    }
+
+  CHECK_CHAR(key);
+
+  if (!(HASH_TABLEP(Qseen_characters)))
+    {
+      /* All the keysym we deal with are character objects; therefore, we
+	 can use eq as the test without worrying. */
+      Qseen_characters = make_lisp_hash_table (128, HASH_TABLE_NON_WEAK,
+					       HASH_TABLE_EQ);
+    }
+  /* Might give the user an opaque error if make_lisp_hash_table fails,
+     but it shouldn't crash. */
+  CHECK_HASH_TABLE(Qseen_characters);
+
+  val = XCHAR(key);
+
+  /* Same logic as in x_has_keysym; I'm not convinced it's sane. */
+  if (val < 0x80) 
+    {
+      return Qnil; 
+    }
+
+  if (!NILP(Fgethash(key, Qseen_characters, Qnil)))
+    {
+      return Qnil;
+    }
+
+  if (NILP (Flookup_key (Vcurrent_global_map, key, Qnil))) 
+    {
+      Fputhash(key, Qt, Qseen_characters);
+      Fdefine_key (Vcurrent_global_map, key, Qself_insert_command); 
+      return Qt; 
+    }
+
+  return Qnil;
+}
+
 void
 mswindows_hide_console (void)
 {
@@ -684,6 +740,7 @@
   CONSOLE_HAS_METHOD (mswindows, canonicalize_device_connection);
 /*  CONSOLE_HAS_METHOD (mswindows, semi_canonicalize_console_connection); */
 /*  CONSOLE_HAS_METHOD (mswindows, semi_canonicalize_device_connection); */
+  CONSOLE_HAS_METHOD (mswindows, perhaps_init_unseen_key_defaults);
 
   INITIALIZE_CONSOLE_TYPE (msprinter, "msprinter", "console-msprinter-p");
   CONSOLE_HAS_METHOD (msprinter, canonicalize_console_connection);
@@ -700,5 +757,6 @@
 void
 vars_of_console_mswindows (void)
 {
+  Qseen_characters = Qnil;
   Fprovide (Qmswindows);
 }
--- a/src/console-tty.c	Sat Jun 25 21:51:12 2005 +0000
+++ b/src/console-tty.c	Sun Jun 26 18:05:05 2005 +0000
@@ -30,6 +30,7 @@
 #include "console-tty-impl.h"
 #include "console-stream.h"
 
+#include "elhash.h"
 #include "faces.h"
 #include "file-coding.h"
 #include "frame.h"
@@ -49,6 +50,8 @@
 Lisp_Object Qterminal_type;
 Lisp_Object Qcontrolling_process;
 
+static Lisp_Object Qseen_characters;
+
 static const struct memory_description tty_console_data_description_1 [] = {
   { XD_LISP_OBJECT, offsetof (struct tty_console, terminal_type) },
   { XD_LISP_OBJECT, offsetof (struct tty_console, instream) },
@@ -344,6 +347,56 @@
   return stream_canonicalize_console_connection (connection, errb);
 }
 
+static Lisp_Object
+tty_perhaps_init_unseen_key_defaults (struct console *UNUSED(con),
+				      Lisp_Object key)
+{
+  Ichar val;
+  extern Lisp_Object Vcurrent_global_map;
+
+  if (SYMBOLP(key))
+    {
+      /* We've no idea what to default an unknown symbol to on the TTY. */
+      return Qnil;
+    }
+
+  CHECK_CHAR(key);
+
+  if (!(HASH_TABLEP(Qseen_characters)))
+    {
+      /* All the keysyms we deal with are character objects; therefore, we
+	 can use eq as the test without worrying. */
+      Qseen_characters = make_lisp_hash_table (128, HASH_TABLE_NON_WEAK,
+					       HASH_TABLE_EQ);
+    }
+
+  /* Might give the user an opaque error if make_lisp_hash_table fails,
+     but it won't crash. */
+  CHECK_HASH_TABLE(Qseen_characters);
+
+  val = XCHAR(key);
+
+  /* Same logic as in x_has_keysym; I'm not convinced it's always sane. */
+  if (val < 0x80) 
+    {
+      return Qnil; 
+    }
+
+  if (!NILP(Fgethash(key, Qseen_characters, Qnil)))
+    {
+      return Qnil;
+    }
+
+  if (NILP (Flookup_key (Vcurrent_global_map, key, Qnil))) 
+    {
+      Fputhash(key, Qt, Qseen_characters);
+      Fdefine_key (Vcurrent_global_map, key, Qself_insert_command); 
+      return Qt; 
+    }
+
+  return Qnil;
+}
+
 
 /************************************************************************/
 /*                            initialization                            */
@@ -377,6 +430,7 @@
   CONSOLE_HAS_METHOD (tty, canonicalize_device_connection);
   CONSOLE_HAS_METHOD (tty, semi_canonicalize_console_connection);
   CONSOLE_HAS_METHOD (tty, semi_canonicalize_device_connection);
+  CONSOLE_HAS_METHOD (tty, perhaps_init_unseen_key_defaults);
 }
 
 void
@@ -397,5 +451,6 @@
 void
 vars_of_console_tty (void)
 {
+  Qseen_characters = Qnil;
   Fprovide (Qtty);
 }
--- a/src/console-x.c	Sat Jun 25 21:51:12 2005 +0000
+++ b/src/console-x.c	Sun Jun 26 18:05:05 2005 +0000
@@ -31,13 +31,18 @@
 #include "lisp.h"
 
 #include "buffer.h"
+#include "device.h"
+#include "elhash.h"
 #include "process.h" /* canonicalize_host_name */
 #include "redisplay.h" /* for display_arg */
 
+#include "device-impl.h"
 #include "console-x-impl.h"
 
 DEFINE_CONSOLE_TYPE (x);
 
+extern void x_has_keysym (KeySym, Lisp_Object, int);
+
 static int
 x_initially_selected_for_input (struct console *UNUSED (con))
 {
@@ -296,6 +301,70 @@
   RETURN_UNGCPRO (concat2 (connection, screen_str));
 }
 
+/* Given a key, if it maps to a character and we weren't previously aware
+   that it could be generated on console CON, and if it's unbound in the
+   global map, bind it to self-insert-command. Return Qt if the binding was
+   done; Qnil if not. */
+
+static Lisp_Object
+x_perhaps_init_unseen_key_defaults (struct console *con, Lisp_Object key)
+{
+  KeySym xkeysym;
+  const Extbyte *keysym_ext;
+  Lisp_Object key_name, previous_binding = Qnil;
+  extern Lisp_Object Qcharacter_of_keysym, Vcurrent_global_map;
+
+  /* Getting the device exactly right is not horrendously important; as long
+     as it's an X11 device it should be okay, because the global keymap (and
+     whether the key is bound) _is_ global, and any previously seen keysym
+     will already be bound, or not, in it. However, there is a corner case
+     where a symbol has been typed, and then explicitly unbound; if the next
+     event using that symbol comes in on some other frame, it'll get bound
+     again. This is not realistically an issue. */
+  struct device *d = XDEVICE(con->selected_device);
+
+  if (SYMBOLP (key))
+    {
+      key_name = symbol_name(XSYMBOL(key));
+    }
+  else
+    {
+      Ibyte buf[MAX_ICHAR_LEN + 1];
+      CHECK_CHAR(key);
+
+      buf[set_itext_ichar(buf, XCHAR(key))] = '\0';
+      key_name = build_string(buf);
+
+      /* We need to do the lookup and compare later, because we can't check
+	 the Qcharacter_of_keysym property belonging to an actual character. */
+      previous_binding = Flookup_key (Vcurrent_global_map, key, Qnil);
+    }
+
+  if (!NILP(Fgethash(key, DEVICE_X_KEYSYM_MAP_HASH_TABLE (d), Qnil)))
+    {
+      return Qnil;
+    }
+
+  LISP_STRING_TO_EXTERNAL (key_name, keysym_ext, Qctext);
+  xkeysym = XStringToKeysym(keysym_ext);
+  if (NoSymbol == xkeysym) 
+    {
+      return Qnil;
+    }
+
+  x_has_keysym(xkeysym, DEVICE_X_KEYSYM_MAP_HASH_TABLE (d), 0);
+
+  if (SYMBOLP(key))
+    {
+      return NILP(Fget (key, Qcharacter_of_keysym, Qnil)) ? Qnil : Qt;
+    }
+  else
+    {
+      return EQ(previous_binding, Flookup_key(Vcurrent_global_map, key, Qnil))
+	? Qnil : Qt;
+    }
+}
+
 void
 console_type_create_x (void)
 {
@@ -307,6 +376,7 @@
   CONSOLE_HAS_METHOD (x, canonicalize_device_connection);
   CONSOLE_HAS_METHOD (x, device_to_console_connection);
   CONSOLE_HAS_METHOD (x, initially_selected_for_input);
+  CONSOLE_HAS_METHOD (x, perhaps_init_unseen_key_defaults);
 }
 
 
--- a/src/device-gtk.c	Sat Jun 25 21:51:12 2005 +0000
+++ b/src/device-gtk.c	Sun Jun 26 18:05:05 2005 +0000
@@ -65,6 +65,8 @@
 Lisp_Object Vgtk_initial_argv_list; /* #### ugh! */
 Lisp_Object Vgtk_initial_geometry;
 
+Lisp_Object Qgtk_seen_characters;
+
 static void gtk_device_init_x_specific_cruft (struct device *d);
 
 static const struct memory_description gtk_device_data_description_1 [] = {
@@ -729,6 +731,8 @@
 
   Vgtk_initial_geometry = Qnil;
   Vgtk_initial_argv_list = Qnil;
+
+  Qgtk_seen_characters = Qnil;
 }
 
 #include <gdk/gdkx.h>
--- a/src/device-x.c	Sat Jun 25 21:51:12 2005 +0000
+++ b/src/device-x.c	Sun Jun 26 18:05:05 2005 +0000
@@ -1812,6 +1812,14 @@
 - if keysym is a string, it must be the name as known to X windows.
 - if keysym is a symbol, it must be the name as known to XEmacs.
 The two names differ in capitalization and underscoring.
+
+This function is not entirely trustworthy, in that Xlib compose processing
+can produce keysyms that XEmacs will not have seen when it examined the
+keysyms available on startup.  So pressing `dead-diaeresis' and then 'a' may
+pass `adiaeresis' to XEmacs, or (in some implementations) even `U00E4',
+where `(x-keysym-on-keyboard-p 'adiaeresis)' and `(x-keysym-on-keyboard-p
+'U00E4)' would both have returned nil.  Subsequent to XEmacs seeing a keysym
+it was previously unaware of, the predicate will take note of it, though.
 */
        (keysym, device))
 {
@@ -2108,7 +2116,7 @@
 If this variable is nil on startup, the application uses `XEmacs'.  Versions
 previous to 21.5.21 examined the resource database and used `XEmacs' if any
 resources beginning with that string existed, and `Emacs' otherwise, for
-greated backward compatibility. However, this has always tended to conflict
+greater backward compatibility. However, this has always tended to conflict
 with GNU Emacs, so this behavior is deprecated--in the short term, you can
 restore it in a post-21.5.21 XEmacs by setting the
 USE_EMACS_AS_DEFAULT_APPLICATION_CLASS environment variable to some value,
--- a/src/editfns.c	Sat Jun 25 21:51:12 2005 +0000
+++ b/src/editfns.c	Sun Jun 26 18:05:05 2005 +0000
@@ -110,10 +110,10 @@
 
   if (EVENTP (character))
     {
-      Lisp_Object ch2 = Fevent_to_character (character, Qt, Qnil, Qnil);
+      Lisp_Object ch2 = Fevent_to_character (character, Qt, Qnil);
       if (NILP (ch2))
         invalid_argument
-	  ("character has no ASCII equivalent:", Fcopy_event (character, Qnil));
+	  ("key has no character equivalent:", Fcopy_event (character, Qnil));
       character = ch2;
     }
 
--- a/src/event-Xt.c	Sat Jun 25 21:51:12 2005 +0000
+++ b/src/event-Xt.c	Sun Jun 26 18:05:05 2005 +0000
@@ -71,7 +71,9 @@
 extern int mswindows_is_blocking;
 #endif
 
-EXFUN (Funicode_to_char, 2);  /* In unicode.c.  */
+/* For Russian C-x processing. */
+#define FIRST_ALPHABETIC_QWERTY_KEYCODE 24	
+#define LAST_ALPHABETIC_QWERTY_KEYCODE  58
 
 /* used in glyphs-x.c */
 void enqueue_focus_event (Widget wants_it, Lisp_Object frame, int in_p);
@@ -136,204 +138,26 @@
 /*                            keymap handling                           */
 /************************************************************************/
 
-/* X bogusly doesn't define the interpretations of any bits besides
-   ModControl, ModShift, and ModLock; so the Interclient Communication
-   Conventions Manual says that we have to bend over backwards to figure
-   out what the other modifier bits mean.  According to ICCCM:
-
-   - Any keycode which is assigned ModControl is a "control" key.
-
-   - Any modifier bit which is assigned to a keycode which generates Meta_L
-     or Meta_R is the modifier bit meaning "meta".  Likewise for Super, Hyper,
-     etc.
-
-   - Any keypress event which contains ModControl in its state should be
-     interpreted as a "control" character.
-
-   - Any keypress event which contains a modifier bit in its state which is
-     generated by a keycode whose corresponding keysym is Meta_L or Meta_R
-     should be interpreted as a "meta" character.  Likewise for Super, Hyper,
-     etc.
-
-   - It is illegal for a keysym to be associated with more than one modifier
-     bit.
-
-   This means that the only thing that emacs can reasonably interpret as a
-   "meta" key is a key whose keysym is Meta_L or Meta_R, and which generates
-   one of the modifier bits Mod1-Mod5.
-
-   Unfortunately, many keyboards don't have Meta keys in their default
-   configuration.  So, if there are no Meta keys, but there are "Alt" keys,
-   emacs will interpret Alt as Meta.  If there are both Meta and Alt keys,
-   then the Meta keys mean "Meta", and the Alt keys mean "Alt" (it used to
-   mean "Symbol," but that just confused the hell out of way too many people).
-
-   This works with the default configurations of the 19 keyboard-types I've
-   checked.
-
-   Emacs detects keyboard configurations which violate the above rules, and
-   prints an error message on the standard-error-output.  (Perhaps it should
-   use a pop-up-window instead.)
- */
-
-/* For every key on the keyboard that has a known character correspondence,
-   we define the ascii-character property of the keysym, and make the
-   default binding for the key be self-insert-command.
-
-   The following magic is basically intimate knowledge of X11/keysymdef.h.
-   The keysym mappings defined by X11 are based on the iso8859 standards,
-   except for Cyrillic and Greek.
-
-   In a non-Mule world, a user can still have a multi-lingual editor, by doing
-   (set-face-font "...-iso8859-2" (current-buffer))
-   for all their Latin-2 buffers, etc.  */
-
-static Lisp_Object
-x_keysym_to_character (KeySym keysym)
-{
-#ifdef MULE
-  Lisp_Object charset = Qzero;
-#define USE_CHARSET(var,cs) \
-  ((var) = charset_by_leading_byte (LEADING_BYTE_##cs))
-#else
-#define USE_CHARSET(var,lb)
-#endif /* MULE */
-  int code = 0;
-
-  if ((keysym & 0xff) < 0xa0)
-    return Qnil;
-
-  /* The spec says keysyms in the range #x01000100 to #x0110FFFF and
-     only those should correspond directly to Unicode code points, in
-     the range #x100-#x10FFFF; actual implementations can have the Latin
-     1 code points do the same thing with keysyms
-     #x010000A0-#x01000100. Oops. */
-
-  if (keysym >= 0x010000A0 && keysym <= 0x0110FFFF) 
-    return Funicode_to_char (make_int(keysym & 0xffffff), Qnil);
-
-  switch (keysym >> 8)
-    {
-    case 0: /* ASCII + Latin1 */
-      USE_CHARSET (charset, LATIN_ISO8859_1);
-      code = keysym & 0x7f;
-      break;
-    case 1: /* Latin2 */
-      USE_CHARSET (charset, LATIN_ISO8859_2);
-      code = keysym & 0x7f;
-      break;
-    case 2: /* Latin3 */
-      USE_CHARSET (charset, LATIN_ISO8859_3);
-      code = keysym & 0x7f;
-      break;
-    case 3: /* Latin4 */
-      USE_CHARSET (charset, LATIN_ISO8859_4);
-      code = keysym & 0x7f;
-      break;
-    case 4: /* Katakana */
-      USE_CHARSET (charset, KATAKANA_JISX0201);
-      if ((keysym & 0xff) > 0xa0)
-	code = keysym & 0x7f;
-      break;
-    case 5: /* Arabic */
-      USE_CHARSET (charset, ARABIC_ISO8859_6);
-      code = keysym & 0x7f;
-      break;
-    case 6: /* Cyrillic */
-      {
-	static unsigned char const cyrillic[] = /* 0x20 - 0x7f */
-	{0x00, 0x72, 0x73, 0x71, 0x74, 0x75, 0x76, 0x77,
-	 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x00, 0x7e, 0x7f,
-	 0x70, 0x22, 0x23, 0x21, 0x24, 0x25, 0x26, 0x27,
-	 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x00, 0x2e, 0x2f,
-	 0x6e, 0x50, 0x51, 0x66, 0x54, 0x55, 0x64, 0x53,
-	 0x65, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e,
-	 0x5f, 0x6f, 0x60, 0x61, 0x62, 0x63, 0x56, 0x52,
-	 0x6c, 0x6b, 0x57, 0x68, 0x6d, 0x69, 0x67, 0x6a,
-	 0x4e, 0x30, 0x31, 0x46, 0x34, 0x35, 0x44, 0x33,
-	 0x45, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e,
-	 0x3f, 0x4f, 0x40, 0x41, 0x42, 0x43, 0x36, 0x32,
-	 0x4c, 0x4b, 0x37, 0x48, 0x4d, 0x49, 0x47, 0x4a};
-	USE_CHARSET (charset, CYRILLIC_ISO8859_5);
-	code = cyrillic[(keysym & 0x7f) - 0x20];
-	break;
-      }
-    case 7: /* Greek */
-      {
-	static unsigned char const greek[] = /* 0x20 - 0x7f */
-	{0x00, 0x36, 0x38, 0x39, 0x3a, 0x5a, 0x00, 0x3c,
-	 0x3e, 0x5b, 0x00, 0x3f, 0x00, 0x00, 0x35, 0x2f,
-	 0x00, 0x5c, 0x5d, 0x5e, 0x5f, 0x7a, 0x40, 0x7c,
-	 0x7d, 0x7b, 0x60, 0x7e, 0x00, 0x00, 0x00, 0x00,
-	 0x00, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
-	 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
-	 0x50, 0x51, 0x53, 0x00, 0x54, 0x55, 0x56, 0x57,
-	 0x58, 0x59, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	 0x00, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
-	 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
-	 0x70, 0x71, 0x73, 0x72, 0x74, 0x75, 0x76, 0x77,
-	 0x78, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
-	USE_CHARSET (charset, GREEK_ISO8859_7);
-	code = greek[(keysym & 0x7f) - 0x20];
-	break;
-      }
-    case 8: /* Technical */
-      break;
-    case 9: /* Special */
-      break;
-    case 10: /* Publishing */
-      break;
-    case 11: /* APL */
-      break;
-    case 12: /* Hebrew */
-      USE_CHARSET (charset, HEBREW_ISO8859_8);
-      code = keysym & 0x7f;
-      break;
-    case 13: /* Thai */
-      /* #### This needs to deal with character composition. */
-      USE_CHARSET (charset, THAI_TIS620);
-      code = keysym & 0x7f;
-      break;
-    case 14: /* Korean Hangul */
-      break;
-    case 19: /* Latin 9 - ISO8859-15 - unsupported charset. */
-      break;
-    case 32: /* Currency */
-      break;
-    default:
-      break;
-    }
-
-  if (code == 0)
-    return Qnil;
-
-#ifdef MULE
-  return make_char (make_ichar (charset, code, 0));
-#else
-  return make_char (code + 0x80);
-#endif
-}
-
-/* See comment near character_to_event().
-*/
+/* See comment near character_to_event(). */
 static void
-maybe_define_x_key_as_self_inserting_character (KeySym keysym, Lisp_Object symbol)
+maybe_define_x_key_as_self_inserting_character (KeySym keysym,
+						Lisp_Object symbol)
 {
   Lisp_Object character = x_keysym_to_character (keysym);
 
   if (CHARP (character))
     {
       extern Lisp_Object Vcurrent_global_map;
-      extern Lisp_Object Qascii_character;
+      extern Lisp_Object Qcharacter_of_keysym;
       if (NILP (Flookup_key (Vcurrent_global_map, symbol, Qnil))) 
         {
-	  Fput (symbol, Qascii_character, character);
+	  Fput (symbol, Qcharacter_of_keysym, character);
 	  Fdefine_key (Vcurrent_global_map, symbol, Qself_insert_command); 
         }
     }
 }
 
-static void
+void
 x_has_keysym (KeySym keysym, Lisp_Object hash_table, int with_modifiers)
 {
   KeySym upper_lower[2];
@@ -355,7 +179,7 @@
 
   for (j = 0; j < (upper_lower[0] == upper_lower[1] ? 1 : 2); j++)
     {
-      char *name;
+      Extbyte *name;
       keysym = upper_lower[j];
 
       name = XKeysymToString (keysym);
@@ -371,7 +195,8 @@
 		    EQ (new_value, Qt)))
 	    {
 	      maybe_define_x_key_as_self_inserting_character (keysym, sym);
-	      Fputhash (build_ext_string (name, Qbinary), new_value, hash_table);
+	      Fputhash (build_ext_string (name, Qbinary), new_value,
+			hash_table);
 	      Fputhash (sym, new_value, hash_table);
 	    }
 	}
@@ -426,7 +251,7 @@
     }
 }
 
-static const char *
+static const Ascbyte *
 index_to_name (int indice)
 {
   switch (indice)
@@ -443,18 +268,43 @@
     }
 }
 
-/* Boy, I really wish C had local functions... */
-struct c_doesnt_have_closures   /* #### not yet used */
-{
-  int warned_about_overlapping_modifiers;
-  int warned_about_predefined_modifiers;
-  int warned_about_duplicate_modifiers;
-  int meta_bit;
-  int hyper_bit;
-  int super_bit;
-  int alt_bit;
-  int mode_bit;
-};
+/* X bogusly doesn't define the interpretations of any bits besides
+   ModControl, ModShift, and ModLock; so the Interclient Communication
+   Conventions Manual says that we have to bend over backwards to figure
+   out what the other modifier bits mean.  According to ICCCM:
+
+   - Any keycode which is assigned ModControl is a "control" key.
+
+   - Any modifier bit which is assigned to a keycode which generates Meta_L
+     or Meta_R is the modifier bit meaning "meta".  Likewise for Super, Hyper,
+     etc.
+
+   - Any keypress event which contains ModControl in its state should be
+     interpreted as a "control" character.
+
+   - Any keypress event which contains a modifier bit in its state which is
+     generated by a keycode whose corresponding keysym is Meta_L or Meta_R
+     should be interpreted as a "meta" character.  Likewise for Super, Hyper,
+     etc.
+
+   - It is illegal for a keysym to be associated with more than one modifier
+     bit.
+
+   This means that the only thing that emacs can reasonably interpret as a
+   "meta" key is a key whose keysym is Meta_L or Meta_R, and which generates
+   one of the modifier bits Mod1-Mod5.
+
+   Unfortunately, many keyboards don't have Meta keys in their default
+   configuration.  So, if there are no Meta keys, but there are "Alt" keys,
+   emacs will interpret Alt as Meta.  If there are both Meta and Alt keys,
+   then the Meta keys mean "Meta", and the Alt keys mean "Alt" (it used to
+   mean "Symbol," but that just confused the hell out of way too many people).
+
+   This works with the default configurations of the 19 keyboard-types I've
+   checked.
+
+   Emacs detects keyboard configurations which violate the above rules, and
+   gives a warning. */
 
 static void
 x_reset_modifier_mapping (struct device *d)
@@ -581,7 +431,7 @@
      be totally wrong. */
   if (mode_bit)
     {
-      const char *warn = 0;
+      const Ascbyte *warn = 0;
       if      (mode_bit == meta_bit)  warn = "Meta",  meta_bit  = 0;
       else if (mode_bit == hyper_bit) warn = "Hyper", hyper_bit = 0;
       else if (mode_bit == super_bit) warn = "Super", super_bit = 0;
@@ -893,7 +743,9 @@
 static Lisp_Object
 x_keysym_to_emacs_keysym (KeySym keysym, int simple_p)
 {
-  char *name;
+  Extbyte *name;
+  DECLARE_EISTRING(einame);
+
   if (keysym >= XK_exclam && keysym <= XK_asciitilde)
     /* We must assume that the X keysym numbers for the ASCII graphic
        characters are the same as their ASCII codes.  */
@@ -914,7 +766,6 @@
     case 0:		return Qnil;
     default:
       if (simple_p) return Qnil;
-      /* !!#### not Mule-ized */
       name = XKeysymToString (keysym);
       if (!name || !name[0])
 	/* This happens if there is a mismatch between the Xlib of
@@ -942,35 +793,40 @@
 	  case 0x1005FF11: return KEYSYM ("SunF37"); /* labeled F12 */
 	  default:
 	    {
-	      char buf [64];
+	      Ascbyte buf [64];
 	      sprintf (buf, "unknown-keysym-0x%X", (int) keysym);
 	      return KEYSYM (buf);
 	    }
 	  }
+      
       /* If it's got a one-character name, that's good enough. */
       if (!name[1])
-	return make_char (name[0]);
+	return make_char ((Ichar)name[0]);
+
+      /* In theory the Host Portable Character Set is just ASCII, but
+         trusting X11 implementors to get that right is likely to lead to
+         tears. */
+      eicpy_ext(einame, name, Qbinary);
 
       /* If it's in the "Keyboard" character set, downcase it.
 	 The case of those keysyms is too totally random for us to
 	 force anyone to remember them.
-	 The case of the other character sets is significant, however.
-	 */
+	 The case of the other character sets is significant, however. */
       if ((((unsigned int) keysym) & (~0x1FF)) == ((unsigned int) 0xFE00))
 	{
-	  char buf [255];
-	  char *s1, *s2;
-	  for (s1 = name, s2 = buf; *s1; s1++, s2++) {
-	    if (*s1 == '_') {
-	      *s2 = '-';
-	    } else {
-	      *s2 = tolower (* (unsigned char *) s1);
+	  Ibyte *iname;
+	  eilwr(einame);
+	  
+	  for (iname = eidata(einame); *iname != '\0';)
+	    {
+	      if (*iname == '_')
+		{
+		  *iname = '-';
+		}
+	      INC_IBYTEPTR(iname);
 	    }
-	  }
-	  *s2 = 0;
-	  return KEYSYM (buf);
 	}
-      return KEYSYM (name);
+      return KEYSYM (eidata(einame));
     }
 }
 
@@ -1139,8 +995,14 @@
   struct x_device *xd = DEVICE_X_DATA (d);
 
   if (DEVICE_X_BEING_DELETED (d))
-     /* #### Uh, is this 0 correct? */
-     return 0;
+    {
+      /* [[ Uh, is this 0 correct? ]] 
+
+         Yup--it means emacs_Xt_event_handler, the only place that calls
+         this, doesn't queue the emacs_event dispatch, instead immediately
+         deallocating it. */
+      return 0;
+    }
 
   set_last_server_timestamp (d, x_event);
 
@@ -1243,9 +1105,22 @@
 	       the keysym) if the keysym isn't a dual-case alphabetic,
 	       and if the caps lock key was down but the shift key
 	       wasn't, then turn off the shift modifier.  Gag barf */
+
 	    /* #### type lossage: assuming equivalence of emacs and
-	       X keysyms */
-	    /* !!#### maybe fix for Mule */
+	       X keysyms
+
+	       The right thing to do here is to have pass a third, pointer,
+	       argument to x_to_emacs_keysym, where it should store the
+	       intermediate KeySym it used to calculate the string XEmacs
+	       keysym. Then we can call keysym_obeys_caps_lock_p with
+	       exactly the right argument. */
+	    /* !!#### maybe fix for Mule
+
+	       Hard, in the absence of a full case infrastructure for
+	       Mule characters. When 
+			(downcase (make-char 'cyrillic-iso8859-5 73)) 
+	       works, we should revisit it.  */
+
 	    if (lock_p && !shift_p &&
 		! (CHAR_OR_CHAR_INTP (keysym)
 		   && keysym_obeys_caps_lock_p
@@ -1274,6 +1149,29 @@
 	    SET_EVENT_TIMESTAMP (emacs_event, ev->time);
 	    SET_EVENT_KEY_MODIFIERS (emacs_event, modifiers);
 	    SET_EVENT_KEY_KEYSYM (emacs_event, keysym);
+
+	    if (ev->keycode >= FIRST_ALPHABETIC_QWERTY_KEYCODE
+		&& ev->keycode <= LAST_ALPHABETIC_QWERTY_KEYCODE)
+	      {
+		/* This correspondence isn't guaranteed by the standards, to
+		   my knowledge. Also, it's incomplete--doesn't include the
+		   upper-case characters, etc--I need to get some feedback
+		   on it once this is out in the world and actually being
+		   used by Russians. */
+		static const Ascbyte qwerty_map[] = 
+		  { 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', 
+		    '[', ']', '\015', '\014',
+		    'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l',
+		    ';', '\'', '`', 0, '\\',
+		    'z', 'x', 'c', 'v', 'b', 'n', 'm' };
+		Ichar val = qwerty_map
+		  [ev->keycode - FIRST_ALPHABETIC_QWERTY_KEYCODE];
+		if (val)
+		  {
+		    SET_EVENT_KEY_ALT_KEYCHARS(emacs_event, KEYCHAR_QWERTY,
+					       val);
+		  }
+	      }
 	  }
 	else                    /* Mouse press/release event */
 	  {
--- a/src/event-msw.c	Sat Jun 25 21:51:12 2005 +0000
+++ b/src/event-msw.c	Sun Jun 26 18:05:05 2005 +0000
@@ -2774,7 +2774,6 @@
 							   mods_with_quit);
 	      } /* while */
 
-#ifdef MULE
 	    /* Also figure out what the character would be in other
 	       possible keyboard layouts, in this order:
 
@@ -2912,7 +2911,6 @@
 		      }
 		  }
 	      }
-#endif /* MULE */
 
 	    /* This generates WM_SYSCHAR messages, which are interpreted
 	       by DefWindowProc as the menu selections. */
--- a/src/event-stream.c	Sat Jun 25 21:51:12 2005 +0000
+++ b/src/event-stream.c	Sun Jun 26 18:05:05 2005 +0000
@@ -128,6 +128,9 @@
 /* Modifier keys are sticky for this many milliseconds. */
 Lisp_Object Vmodifier_keys_sticky_time;
 
+/* If true, "Russian C-x processing" is enabled. */
+int try_alternate_layouts_for_commands;
+
 /* Here FSF Emacs 20.7 defines Vpost_command_idle_hook,
    post_command_idle_delay, Vdeferred_action_list, and
    Vdeferred_action_function, but we don't because that stuff is crap,
@@ -215,11 +218,6 @@
 Lisp_Object Vretry_undefined_key_binding_unshifted;
 Lisp_Object Qretry_undefined_key_binding_unshifted;
 
-#ifdef MULE
-/* If composed input is undefined, use self-insert-char */
-Lisp_Object Vcomposed_character_default_binding;
-#endif
-
 /* Console that corresponds to our controlling terminal */
 Lisp_Object Vcontrolling_terminal;
 
@@ -2364,7 +2362,7 @@
      Note that last-input-char will never have its high-bit set, in an
      effort to sidestep the ambiguity between M-x and oslash.
      */
-  Vlast_input_char = Fevent_to_character (Vlast_input_event, Qnil, Qnil, Qnil);
+  Vlast_input_char = Fevent_to_character (Vlast_input_event, Qnil, Qnil);
   {
     EMACS_TIME t;
     EMACS_GET_TIME (t);
@@ -3169,7 +3167,7 @@
   if (EQ (Fhash_table_count (Vkeyboard_translate_table), Qzero))
     return;
 
-  c = event_to_character (event, 0, 0, 0);
+  c = event_to_character (event, 0, 0);
   if (c != -1)
     {
       Lisp_Object traduit = Fgethash (make_char (c), Vkeyboard_translate_table,
@@ -3315,12 +3313,14 @@
   return Qnil;
 }
 
-/* Same as command_builder_find_leaf() below but no Russian C-x
-   processing and no defaulting to self-insert-command.
- */
+/* Same as command_builder_find_leaf() below, but without offering the
+   platform-specific event code the opportunity to give a default binding of
+   an unseen keysym to self-insert-command, and without the fallback to
+   other keymaps for lookups that allows someone with a Cyrillic keyboard
+   to pretend it's Qwerty for C-x C-f, for example. */
 
 static Lisp_Object
-command_builder_find_leaf_no_mule_processing (struct command_builder *builder,
+command_builder_find_leaf_no_jit_binding (struct command_builder *builder,
 					      int allow_misc_user_events_p,
 					      int *did_munge)
 {
@@ -3397,7 +3397,7 @@
 	  GCPRO1 (neubauten);
 	  downshift_event (event_chain_tail (neub->current_events));
           result =
-	    command_builder_find_leaf_no_mule_processing
+	    command_builder_find_leaf_no_jit_binding
 	      (neub, allow_misc_user_events_p, did_munge);
 
           if (!NILP (result))
@@ -3442,7 +3442,42 @@
 
    DID_MUNGE must be initialized before calling this function.  If munging
    happened, DID_MUNGE will be non-zero; otherwise, it will be left alone.
- */
+
+   (The above was Ben, I think.)
+
+   It might be nice to have lookup-key call this function, directly or
+   indirectly. Though it is arguably the right thing if lookup-key fails on
+   a keysym that the X11 event code hasn't seen. There's no way to know if
+   that keysym is generatable by the keyboard until it's generated,
+   therefore there's no reasonable expectation that it be bound before it's
+   generated--all the other default bindings depend on our knowing the
+   keyboard layout and relying on it. And describe-key works without it, so
+   I think we're fine.
+
+   Some weirdness with this code--try this on a keyboard where X11 will
+   produce ediaeresis with dead-diaeresis and e, but it's not produced by
+   any other combination of keys on the keyboard;
+
+   (defun ding-command ()
+     (interactive)
+     (ding))
+
+   (define-key global-map 'ediaeresis 'ding-command)
+
+   Now, pressing dead-diaeresis and then e will ding. Next; 
+
+   (define-key global-map 'ediaeresis 'self-insert-command) 
+   
+   and press dead-diaeresis and then e. It'll give you "Invalid argument:
+   typed key has no ASCII equivalent" Then; 
+
+   (define-key global-map 'ediaeresis nil)
+
+   and press the combination again; it'll self-insert. The moral of the
+   story is, if you want to suppress all bindings to a non-ASCII X11 key,
+   bind it to a trivial no-op command, because the automatic mapping to
+   self-insert-command will happen if there's no existing binding for the
+   symbol. I can't see a way around this. -- Aidan Kehoe, 2005-05-14 */
 
 static Lisp_Object
 command_builder_find_leaf (struct command_builder *builder,
@@ -3450,24 +3485,141 @@
 			   int *did_munge)
 {
   Lisp_Object result =
-    command_builder_find_leaf_no_mule_processing
+    command_builder_find_leaf_no_jit_binding
       (builder, allow_misc_user_events_p, did_munge);
+  Lisp_Object event, console, channel, lookup_res;
+  int redolookup = 0, i;
 
   if (!NILP (result))
     return result;
 
-#ifdef MULE
-  /* #### Do Russian C-x processing here */
-
-  /* If keysym is a non-ASCII char, bind it to self-insert-char by default. */
-  if (XEVENT_TYPE (builder->most_current_event) == key_press_event
-      && !NILP (Vcomposed_character_default_binding))
+  /* If some of the events are keyboard events, and this is the first time
+     the platform event code has seen their keysyms--which will be the case
+     the first time we see a composed keysym on X11, for example--offer it
+     the chance to define them as a self-insert-command, and do the lookup
+     again.
+
+     This isn't Mule-specific; in a world where x-iso8859-1.el is gone, it's
+     needed for non-Mule too.
+
+     Probably this can just be limited to the checking the last
+     keypress. */
+
+  EVENT_CHAIN_LOOP (event, builder->current_events)
+    {
+      /* We can ignore key release events because the preceding presses will
+     	 have initiated the mapping. */
+      if (key_press_event != XEVENT_TYPE (event))
+     	continue;
+
+      channel = XEVENT_CHANNEL (event);
+      if (object_dead_p (channel))
+	continue;
+
+      console = CDFW_CONSOLE (channel);
+      if (NILP (console))
+     	console = Vselected_console;
+
+      if (CONSOLE_LIVE_P(XCONSOLE(console)))
+	{
+	  lookup_res = MAYBE_LISP_CONMETH(XCONSOLE(console), 
+					  perhaps_init_unseen_key_defaults, 
+					  (XCONSOLE(console),
+					   XEVENT_KEY_KEYSYM(event)));
+	  if (EQ(lookup_res, Qt))
+	    {
+	      redolookup += 1;
+	    }
+	}
+    }
+
+  if (redolookup)
     {
-      Lisp_Object keysym = XEVENT_KEY_KEYSYM (builder->most_current_event);
-      if (CHARP (keysym) && !ichar_ascii_p (XCHAR (keysym)))
-        return Vcomposed_character_default_binding;
+      result = command_builder_find_leaf_no_jit_binding
+	(builder, allow_misc_user_events_p, did_munge);
+      if (!NILP (result))
+	{
+	  return result;
+	}
+    }
+
+  /* The old composed-character-default-binding handling that used to be
+     here was wrong--if a user wants to bind a given key to something other
+     than self-insert-command, then they should go ahead and do it, we won't
+     override it, and the sane thing to do with any key that has a known
+     character correspondence is _always_ to default it to
+     self-insert-command, nothing else.
+
+     I'm adding the variable to control whether "Russian C-x processing" is
+     used because I have a feeling that it's not always the most appropriate
+     thing to do--in cases where people are using a non-Qwerty
+     Roman-alphabet layout, do they really want C-x with some random letter
+     to call `switch-to-buffer'? I can imagine that being very confusing,
+     certainly for new users, and it might be that defaulting the value for
+     `try-alternate-layouts-for-commands' as part of the language
+     environment is the right thing to do, only defaulting to `t' for those
+     languages that don't use the Roman alphabet. 
+
+     Much of that reasoning is tentative on my part, and feel free to change
+     this code if you have more experience with the problem and an intuition
+     that differs from mine. (Aidan Kehoe, 2005-05-29)*/ 
+
+  if (!try_alternate_layouts_for_commands)
+    {
+      return Qnil; 
     }
-#endif
+
+  if (key_press_event == XEVENT_TYPE (builder->most_current_event))
+    {
+      Lisp_Object ev = builder->most_current_event, newbuilder;
+      Ichar this_alternative;
+
+      struct command_builder *newb;
+      struct gcpro gcpro1;
+
+      /* Ignore the value for CURRENT_LANGENV, because we've checked it
+	 already, above. */
+      for (i = KEYCHAR_CURRENT_LANGENV, ++i; i < KEYCHAR_LAST; ++i)
+	{
+	  this_alternative = XEVENT_KEY_ALT_KEYCHARS(ev, i);
+
+	  if (0 == this_alternative)
+	    continue;
+
+	  newbuilder = copy_command_builder(builder, 0);
+	  GCPRO1(newbuilder);
+
+	  newb = XCOMMAND_BUILDER(newbuilder);
+
+	  XSET_EVENT_KEY_KEYSYM(event_chain_tail (newbuilder->current_events), 
+				make_char(this_alternative));
+
+	  result = command_builder_find_leaf_no_jit_binding
+	    (newb, allow_misc_user_events_p, did_munge);
+
+	  if (!NILP (result))
+	    {
+	      copy_command_builder (newb, builder);
+	      *did_munge = 1;
+	    }
+	  else if (event_upshifted_p (newbuilder->most_current_event) &&
+		   !NILP (Vretry_undefined_key_binding_unshifted)
+		   && isascii(this_alternative))
+	    {
+	      downshift_event (event_chain_tail (newbuilder->current_events));
+	      XSET_EVENT_KEY_KEYSYM(event_chain_tail (newb->current_events), 
+				    make_char(tolower(this_alternative)));
+	      result = command_builder_find_leaf_no_jit_binding
+		(newb, allow_misc_user_events_p, did_munge);
+	    }
+
+	  free_command_builder (newb);
+	  UNGCPRO;
+
+	  if (!NILP (result))
+	    return result;
+	}
+    }
 
   return Qnil;
 }
@@ -4096,7 +4248,7 @@
   /* Note that last-command-char will never have its high-bit set, in
      an effort to sidestep the ambiguity between M-x and oslash. */
   Vlast_command_char = Fevent_to_character (Vlast_command_event,
-					    Qnil, Qnil, Qnil);
+					    Qnil, Qnil);
 
   /* Actually call the command, with all sorts of hair to preserve or clear
      the echo-area and region as appropriate and call the pre- and post-
@@ -5062,17 +5214,6 @@
 */ );
   Vmodifier_keys_sticky_time = make_int (500);
 
-#ifdef MULE
-  DEFVAR_LISP ("composed-character-default-binding",
-               &Vcomposed_character_default_binding /*
-The default keybinding to use for key events from composed input.
-Window systems frequently have ways to allow the user to compose
-single characters in a language using multiple keystrokes.
-XEmacs sees these as single character keypress events.
-*/ );
-  Vcomposed_character_default_binding = Qself_insert_command;
-#endif
-
   Vcontrolling_terminal = Qnil;
   staticpro (&Vcontrolling_terminal);
 
@@ -5118,13 +5259,32 @@
   debug_emacs_events = 0;
 #endif
 
-  DEFVAR_BOOL ("inhibit-input-event-recording", &inhibit_input_event_recording /*
+  DEFVAR_BOOL ("inhibit-input-event-recording",
+	       &inhibit_input_event_recording /*
 Non-nil inhibits recording of input-events to recent-keys ring.
 */ );
   inhibit_input_event_recording = 0;
 
   Vkeyboard_translate_table =
     make_lisp_hash_table (100, HASH_TABLE_NON_WEAK, HASH_TABLE_EQ);
+
+  DEFVAR_BOOL ("try-alternate-layouts-for-commands",
+	       &try_alternate_layouts_for_commands /*
+Non-nil means that if looking up a command from a sequence of keys typed by
+the user would otherwise fail, try it again with some other keyboard
+layout. On X11, the only alternative to the default mapping is American
+QWERTY; on Windows, other mappings may be available, depending on things
+like the default language environment for the current user, for the system,
+&c.
+
+With a Russian keyboard layout on X11, for example, this means that
+C-Cyrillic_che C-Cyrillic_a, if you haven't given that sequence a binding
+yourself, will invoke `find-file.' This is because `Cyrillic_che' is
+physically where `x' is, and `Cyrillic_a' is where `f' is, on an American
+Qwerty layout, and, of course, C-x C-f is a default emacs binding for that
+command.
+*/ );
+  try_alternate_layouts_for_commands = 1;
 }
 
 void
--- a/src/event-xlike-inc.c	Sat Jun 25 21:51:12 2005 +0000
+++ b/src/event-xlike-inc.c	Sun Jun 26 18:05:05 2005 +0000
@@ -27,6 +27,8 @@
    included here, not in event-xlike.c.  However, event-xlike.c is always
    X-specific, whereas the following code isn't, in the GTK case. */
 
+EXFUN (Funicode_to_char, 2);  /* In unicode.c.  */
+
 static int
 #ifdef THIS_IS_GTK
 emacs_gtk_event_pending_p (int how_many)
@@ -159,3 +161,473 @@
 
   return 0;
 }
+
+#if defined(THIS_IS_X) || !defined(__GDK_KEYS_H__)
+
+/* Use an appropriate map to Unicode within x_keysym_to_character. Arguments
+   are evaluated multiple times.
+
+   Breaks if an X11 keysym maps to zero in Unicode. */
+
+#define USE_UNICODE_MAP(keysym, map)					\
+  if (keysym >= FIRST_KNOWN_##map					\
+      && (keysym < (FIRST_KNOWN_##map + countof(map)))			\
+      && map[keysym - FIRST_KNOWN_##map ]) do				\
+    {									\
+      keysym -= FIRST_KNOWN_##map ;					\
+      return Funicode_to_char(make_int(map[keysym]), Qnil);		\
+    } while (0)
+
+/* Maps to Unicode for X11 KeySyms, where we don't have a direct internal
+   mapping based on a Mule character set, or whatever. Taken from Markus
+   Kuhn's X11.keysyms--if you're ever comparing with that file, note the
+   sequences of KeySyms often leave out entries, so you'll have to fill them
+   in. Doesn't include support for Hangul, which it should, if the X11
+   Hangul keysyms have ever been used anywhere.
+
+   I'm not #ifdef'ing this based on wheter MULE is defined, because it's a
+   matter of 324 bytes in a stripped executable, and I want the
+   testing. :-P */
+
+static UINT_16_BIT const TECHNICAL[] = 
+  {
+    0x23B7,	/* #x08A1 LEFT RADICAL	Technical */
+
+#define FIRST_KNOWN_TECHNICAL 0x8A1
+
+    0x0,	/* #x08A2 TOP LEFT RADICAL	Technical */
+    0x0,	/* #x08A3 HORIZONTAL CONNECTOR	Technical */
+    0x2320,	/* #x08A4 TOP INTEGRAL	Technical */
+    0x2321,	/* #x08A5 BOTTOM INTEGRAL	Technical */
+    0x0,	/* #x08A6 VERTICAL CONNECTOR	Technical */
+    0x23A1,	/* #x08A7 TOP LEFT SQUARE BRACKET	Technical */
+    0x23A3,	/* #x08A8 BOTTOM LEFT SQUARE BRACKET	Technical */
+    0x23A4,	/* #x08A9 TOP RIGHT SQUARE BRACKET	Technical */
+    0x23A6,	/* #x08AA BOTTOM RIGHT SQUARE BRACKET	Technical */
+    0x239B,	/* #x08AB TOP LEFT PARENTHESIS	Technical */
+    0x239D,	/* #x08AC BOTTOM LEFT PARENTHESIS	Technical */
+    0x239E,	/* #x08AD TOP RIGHT PARENTHESIS	Technical */
+    0x23A0,	/* #x08AE BOTTOM RIGHT PARENTHESIS	Technical */
+    0x23A8,	/* #x08AF LEFT MIDDLE CURLY BRACE	Technical */
+    0x23AC,	/* #x08B0 RIGHT MIDDLE CURLY BRACE	Technical */
+    0x0,	/* #x08B1 TOP LEFT SUMMATION	Technical */
+    0x0,	/* #x08B2 BOTTOM LEFT SUMMATION	Technical */
+    0x0,	/* #x08B3 TOP VERTICAL SUMMATION CONNECTOR	Technical */
+    0x0,	/* #x08B4 BOTTOM VERTICAL SUMMATION CONNECTOR	Technical */
+    0x0,	/* #x08B5 TOP RIGHT SUMMATION	Technical */
+    0x0,	/* #x08B6 BOTTOM RIGHT SUMMATION	Technical */
+    0x0,	/* #x08B7 RIGHT MIDDLE SUMMATION	Technical */
+    0x0,	/* #x08B8 */
+    0x0,	/* #x08B9 */
+    0x0,	/* #x08BA */
+    0x0,	/* #x08BB */
+    0x2264,	/* #x08BC LESS THAN OR EQUAL SIGN	Technical */
+    0x2260,	/* #x08BD NOT EQUAL SIGN	Technical */
+    0x2265,	/* #x08BE GREATER THAN OR EQUAL SIGN	Technical */
+    0x222B,	/* #x08BF INTEGRAL	Technical */
+    0x2234,	/* #x08C0 THEREFORE	Technical */
+    0x221D,	/* #x08C1 VARIATION, PROPORTIONAL TO	Technical */
+    0x221E,	/* #x08C2 INFINITY	Technical */
+    0x0,	/* #x08C3 */
+    0x0,	/* #x08C4 */
+    0x2207,	/* #x08C5 NABLA, DEL	Technical */
+    0x0,	/* #x08C6 */
+    0x0,	/* #x08C7 */
+    0x223C,	/* #x08C8 IS APPROXIMATE TO	Technical */
+    0x2243,	/* #x08C9 SIMILAR OR EQUAL TO	Technical */
+    0x0,	/* #x08CA */
+    0x0,	/* #x08CB */
+    0x0,	/* #x08CC */
+    0x21D4,	/* #x08CD IF AND ONLY IF	Technical */
+    0x21D2,	/* #x08CE IMPLIES	Technical */
+    0x2261,	/* #x08CF IDENTICAL TO	Technical */
+    0x0,	/* #x08D0 */
+    0x0,	/* #x08D1 */
+    0x0,	/* #x08D2 */
+    0x0,	/* #x08D3 */
+    0x0,	/* #x08D4 */
+    0x0,	/* #x08D5 */
+    0x221A,	/* #x08D6 RADICAL	Technical */
+    0x0,	/* #x08D7 */
+    0x0,	/* #x08D8 */
+    0x0,	/* #x08D9 */
+    0x2282,	/* #x08DA IS INCLUDED IN	Technical */
+    0x2283,	/* #x08DB INCLUDES	Technical */
+    0x2229,	/* #x08DC INTERSECTION	Technical */
+    0x222A,	/* #x08DD UNION	Technical */
+    0x2227,	/* #x08DE LOGICAL AND	Technical */
+    0x2228,	/* #x08DF LOGICAL OR	Technical */
+    0x0,	/* #x08E0 */
+    0x0,	/* #x08E1 */
+    0x0,	/* #x08E2 */
+    0x0,	/* #x08E3 */
+    0x0,	/* #x08E4 */
+    0x0,	/* #x08E5 */
+    0x0,	/* #x08E6 */
+    0x0,	/* #x08E7 */
+    0x0,	/* #x08E8 */
+    0x0,	/* #x08E9 */
+    0x0,	/* #x08Ea */
+    0x0,	/* #x08Eb */
+    0x0,	/* #x08Ec */
+    0x0,	/* #x08Ed */
+    0x0,	/* #x08Ee */
+    0x2202,	/* #x08EF PARTIAL DERIVATIVE	Technical */
+    0x0,	/* #x08F0 */
+    0x0,	/* #x08F1 */
+    0x0,	/* #x08F2 */
+    0x0,	/* #x08F3 */
+    0x0,	/* #x08F4 */
+    0x0,	/* #x08F5 */
+    0x0192,	/* #x08F6 FUNCTION	Technical */
+    0x0,	/* #x08F7 */
+    0x0,	/* #x08F8 */
+    0x0,	/* #x08F9 */
+    0x0,	/* #x08FA */
+    0x2190,	/* #x08FB LEFT ARROW	Technical */
+    0x2191,	/* #x08FC UPWARD ARROW	Technical */
+    0x2192,	/* #x08FD RIGHT ARROW	Technical */
+    0x2193,	/* #x08FE DOWNWARD ARROW	Technical */
+  };
+
+static UINT_16_BIT const SPECIAL[] = 
+  {
+    0x25C6,	/* #x09E0 SOLID DIAMOND	Special */
+
+#define FIRST_KNOWN_SPECIAL 0x9E0
+
+    0x2592,	/* #x09E1 CHECKERBOARD	Special */
+    0x2409,	/* #x09E2 ``HT''	Special */
+    0x240C,	/* #x09E3 ``FF''	Special */
+    0x240D,	/* #x09E4 ``CR''	Special */
+    0x240A,	/* #x09E5 ``LF''	Special */
+    0x0,	/* #x09E6 */
+    0x0,	/* #x09E7 */
+    0x2424,	/* #x09E8 ``NL''	Special */
+    0x240B,	/* #x09E9 ``VT''	Special */
+    0x2518,	/* #x09EA LOWER-RIGHT CORNER	Special */
+    0x2510,	/* #x09EB UPPER-RIGHT CORNER	Special */
+    0x250C,	/* #x09EC UPPER-LEFT CORNER	Special */
+    0x2514,	/* #x09ED LOWER-LEFT CORNER	Special */
+    0x253C,	/* #x09EE CROSSING-LINES	Special */
+    0x23BA,	/* #x09EF HORIZONTAL LINE, SCAN 1	Special */
+    0x23BB,	/* #x09F0 HORIZONTAL LINE, SCAN 3	Special */
+    0x2500,	/* #x09F1 HORIZONTAL LINE, SCAN 5	Special */
+    0x23BC,	/* #x09F2 HORIZONTAL LINE, SCAN 7	Special */
+    0x23BD,	/* #x09F3 HORIZONTAL LINE, SCAN 9	Special */
+    0x251C,	/* #x09F4 LEFT ``T''	Special */
+    0x2524,	/* #x09F5 RIGHT ``T''	Special */
+    0x2534,	/* #x09F6 BOTTOM ``T''	Special */
+    0x252C,	/* #x09F7 TOP ``T''	Special */
+    0x2502	/* #x09F8 VERTICAL BAR	Special */
+  };
+
+static UINT_16_BIT const PUBLISHING[] = 
+  {
+    0x2003,	/* #x0AA1 EM SPACE	Publish */
+
+#define FIRST_KNOWN_PUBLISHING 0xAA1
+
+    0x2002,	/* #x0AA2 EN SPACE	Publish */
+    0x2004,	/* #x0AA3 3/EM SPACE	Publish */
+    0x2005,	/* #x0AA4 4/EM SPACE	Publish */
+    0x2007,	/* #x0AA5 DIGIT SPACE	Publish */
+    0x2008,	/* #x0AA6 PUNCTUATION SPACE	Publish */
+    0x2009,	/* #x0AA7 THIN SPACE	Publish */
+    0x200A,	/* #x0AA8 HAIR SPACE	Publish */
+    0x2014,	/* #x0AA9 EM DASH	Publish */
+    0x2013,	/* #x0AAA EN DASH	Publish */
+    0x0,	/* #x0AAB */
+    0x0,	/* #x0AAC SIGNIFICANT BLANK SYMBOL	Publish */
+    0x0,	/* #x0AAD */
+    0x2026,	/* #x0AAE ELLIPSIS	Publish */
+    0x2025,	/* #x0AAF DOUBLE BASELINE DOT	Publish */
+    0x2153,	/* #x0AB0 VULGAR FRACTION ONE THIRD	Publish */
+    0x2154,	/* #x0AB1 VULGAR FRACTION TWO THIRDS	Publish */
+    0x2155,	/* #x0AB2 VULGAR FRACTION ONE FIFTH	Publish */
+    0x2156,	/* #x0AB3 VULGAR FRACTION TWO FIFTHS	Publish */
+    0x2157,	/* #x0AB4 VULGAR FRACTION THREE FIFTHS	Publish */
+    0x2158,	/* #x0AB5 VULGAR FRACTION FOUR FIFTHS	Publish */
+    0x2159,	/* #x0AB6 VULGAR FRACTION ONE SIXTH	Publish */
+    0x215A,	/* #x0AB7 VULGAR FRACTION FIVE SIXTHS	Publish */
+    0x2105,	/* #x0AB8 CARE OF	Publish */
+    0x0,	/* #x0AB9 */
+    0x0,	/* #x0ABA */
+    0x2012,	/* #x0ABB FIGURE DASH	Publish */
+    0x0,	/* #x0ABC LEFT ANGLE BRACKET	Publish */
+    0x0,	/* #x0ABD DECIMAL POINT	Publish */
+    0x0,	/* #x0ABE RIGHT ANGLE BRACKET	Publish */
+    0x0,	/* #x0ABF MARKER	Publish */
+    0x0,	/* #x0AC0 */
+    0x0,	/* #x0AC1 */
+    0x0,	/* #x0AC2 */
+    0x215B,	/* #x0AC3 VULGAR FRACTION ONE EIGHTH	Publish */
+    0x215C,	/* #x0AC4 VULGAR FRACTION THREE EIGHTHS	Publish */
+    0x215D,	/* #x0AC5 VULGAR FRACTION FIVE EIGHTHS	Publish */
+    0x215E,	/* #x0AC6 VULGAR FRACTION SEVEN EIGHTHS	Publish */
+    0x0,	/* #x0AC7 */
+    0x0,	/* #x0AC8 */
+    0x2122,	/* #x0AC9 TRADEMARK SIGN	Publish */
+    0x0,	/* #x0ACA SIGNATURE MARK	Publish */
+    0x0,	/* #x0ACB TRADEMARK SIGN IN CIRCLE	Publish */
+    0x0,	/* #x0ACC LEFT OPEN TRIANGLE	Publish */
+    0x0,	/* #x0ACD RIGHT OPEN TRIANGLE	Publish */
+    0x0,	/* #x0ACE EM OPEN CIRCLE	Publish */
+    0x0,	/* #x0ACF EM OPEN RECTANGLE	Publish */
+    0x2018,	/* #x0AD0 LEFT SINGLE QUOTATION MARK	Publish */
+    0x2019,	/* #x0AD1 RIGHT SINGLE QUOTATION MARK	Publish */
+    0x201C,	/* #x0AD2 LEFT DOUBLE QUOTATION MARK	Publish */
+    0x201D,	/* #x0AD3 RIGHT DOUBLE QUOTATION MARK	Publish */
+    0x211E,	/* #x0AD4 PRESCRIPTION, TAKE, RECIPE	Publish */
+    0x0,	/* #x0AD5 */
+    0x2032,	/* #x0AD6 MINUTES	Publish */
+    0x2033,	/* #x0AD7 SECONDS	Publish */
+    0x0,	/* #x0AD8 */
+    0x271D,	/* #x0AD9 LATIN CROSS	Publish */
+    0x0,	/* #x0ADA HEXAGRAM	Publish */
+    0x0,	/* #x0ADB FILLED RECTANGLE BULLET	Publish */
+    0x0,	/* #x0ADC FILLED LEFT TRIANGLE BULLET	Publish */
+    0x0,	/* #x0ADD FILLED RIGHT TRIANGLE BULLET	Publish */
+    0x0,	/* #x0ADE EM FILLED CIRCLE	Publish */
+    0x0,	/* #x0ADF EM FILLED RECTANGLE	Publish */
+    0x0,	/* #x0AE0 EN OPEN CIRCLE BULLET	Publish */
+    0x0,	/* #x0AE1 EN OPEN SQUARE BULLET	Publish */
+    0x0,	/* #x0AE2 OPEN RECTANGULAR BULLET	Publish */
+    0x0,	/* #x0AE3 OPEN TRIANGULAR BULLET UP	Publish */
+    0x0,	/* #x0AE4 OPEN TRIANGULAR BULLET DOWN	Publish */
+    0x0,	/* #x0AE5 OPEN STAR	Publish */
+    0x0,	/* #x0AE6 EN FILLED CIRCLE BULLET	Publish */
+    0x0,	/* #x0AE7 EN FILLED SQUARE BULLET	Publish */
+    0x0,	/* #x0AE8 FILLED TRIANGULAR BULLET UP	Publish */
+    0x0,	/* #x0AE9 FILLED TRIANGULAR BULLET DOWN	Publish */
+    0x0,	/* #x0AEA LEFT POINTER	Publish */
+    0x0,	/* #x0AEB RIGHT POINTER	Publish */
+    0x2663,	/* #x0AEC CLUB	Publish */
+    0x2666,	/* #x0AED DIAMOND	Publish */
+    0x2665,	/* #x0AEE HEART	Publish */
+    0x0,	/* #x0AEF */
+    0x2720,	/* #x0AF0 MALTESE CROSS	Publish */
+    0x2020,	/* #x0AF1 DAGGER	Publish */
+    0x2021,	/* #x0AF2 DOUBLE DAGGER	Publish */
+    0x2713,	/* #x0AF3 CHECK MARK, TICK	Publish */
+    0x2717,	/* #x0AF4 BALLOT CROSS	Publish */
+    0x266F,	/* #x0AF5 MUSICAL SHARP	Publish */
+    0x266D,	/* #x0AF6 MUSICAL FLAT	Publish */
+    0x2642,	/* #x0AF7 MALE SYMBOL	Publish */
+    0x2640,	/* #x0AF8 FEMALE SYMBOL	Publish */
+    0x260E,	/* #x0AF9 TELEPHONE SYMBOL	Publish */
+    0x2315,	/* #x0AFA TELEPHONE RECORDER SYMBOL	Publish */
+    0x2117,	/* #x0AFB PHONOGRAPH COPYRIGHT SIGN	Publish */
+    0x2038,	/* #x0AFC CARET	Publish */
+    0x201A,	/* #x0AFD SINGLE LOW QUOTATION MARK	Publish */
+    0x201E,	/* #x0AFE DOUBLE LOW QUOTATION MARK	Publish */
+  };
+
+static UINT_16_BIT const APL[] = 
+  {
+    0x22A5,	/* #x0BC2 DOWN TACK	APL */
+#define FIRST_KNOWN_APL 0xBC2
+    0x0,	/* #x0BC3 UP SHOE (CAP)	APL */
+    0x230A,	/* #x0BC4 DOWN STILE	APL */
+    0x0,	/* #x0BC5 */
+    0x0,	/* #x0BC6 UNDERBAR	APL */
+    0x0,	/* #x0BC7 */
+    0x0,	/* #x0BC8 */
+    0x0,	/* #x0BC9 */
+    0x2218,	/* #x0BCA JOT	APL */
+    0x0,	/* #x0BCB */
+    0x2395,	/* #x0BCC QUAD	APL */
+    0x0,	/* #x0BCD */
+    0x22A4,	/* #x0BCE UP TACK	APL */
+    0x25CB,	/* #x0BCF CIRCLE	APL */
+    0x0,	/* #x0BD0 */
+    0x0,	/* #x0BD1 */
+    0x0,	/* #x0BD2 */
+    0x2308,	/* #x0BD3 UP STILE	APL */
+    0x0,	/* #x0BD4 */
+    0x0,	/* #x0BD5 */
+    0x0,	/* #x0BD6 DOWN SHOE (CUP)	APL */
+    0x0,	/* #x0BD7 */
+    0x0,	/* #x0BD8 RIGHT SHOE	APL */
+    0x0,	/* #x0BD9 */
+    0x0,	/* #x0BDA LEFT SHOE	APL */
+    0x0,	/* #x0BDB */
+    0x0,	/* #x0BDC */
+    0x22A2,	/* #x0BDC LEFT TACK	APL */
+    0x0,	/* #x0BDE */
+    0x0,	/* #x0BDF */
+    0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, /* 0x0BB0--0x0BBB */
+    0x0, 0x0, 0x0, 0x0,
+    0x22A3,	/* #x0BFC RIGHT TACK	APL */
+  };
+
+/* For every key on the keyboard that has a known character correspondence,
+   we define the character-of-keysym property of its XEmacs keysym, and make
+   the default binding for the key be self-insert-command.
+
+   The following magic is based on intimate knowledge of some of
+   X11/keysymdef.h.  The keysym mappings defined by X11 are based on the
+   iso8859 standards, except for Cyrillic and Greek.
+
+   In a non-Mule world, a user can still have a multi-lingual editor, by
+   doing (set-face-font "...-iso8859-2" (current-buffer)) for all their
+   Latin-2 buffers, etc. and the X11 keysyms corresponding to characters in
+   those character sets will still do the right thing (because of the
+   make_char (code + 0x80) non-Mule case below.) Of course, X11 keysyms in
+   other character sets will not do the right thing, because XEmacs won't
+   support the right thing.
+
+   This code is also called when a command lookup is about to fail, and the
+   X11 platform code has worked out that it previously wasn't aware the
+   keysym of that command could be generated by the user's keyboard; in that
+   case, we bind its XEmacs keysym to self-insert-command if it has a
+   character correspondence we know about, and tell the general event code
+   that we've done so, so it can try the lookup again.
+
+   Called from the GTK code because GTK 1 has no defined way of doing the
+   same thing, and this works for it on X11. It should be moved back into
+   event-Xt.c when and if the GTK port moves to GTK 2. */
+
+#ifndef THIS_IS_GTK
+static Lisp_Object
+x_keysym_to_character(KeySym keysym)
+#else
+Lisp_Object
+gtk_keysym_to_character(guint keysym)
+#endif
+{
+  Lisp_Object charset = Qzero;
+  int code = 0;
+
+  /* Markus Kuhn's spec says keysyms in the range #x01000100 to #x0110FFFF
+     and only those should correspond directly to Unicode code points, in
+     the range #x100-#x10FFFF; actual implementations can have the Latin 1
+     code points do the same thing with keysyms
+     #x010000A0-#x01000100. */
+
+  if (keysym >= 0x010000A0 && keysym <= 0x0110FFFF)
+    return Funicode_to_char (make_int(keysym & 0xffffff), Qnil);
+
+  if ((keysym & 0xff) < 0xa0)
+    return Qnil;
+
+  switch (keysym >> 8)
+    {
+
+#define USE_CHARSET(var,cs) \
+  ((var) = charset_by_leading_byte (LEADING_BYTE_##cs))
+
+    case 0: /* ASCII + Latin1 */
+      USE_CHARSET (charset, LATIN_ISO8859_1);
+      code = keysym & 0x7f;
+      break;
+    case 1: /* Latin2 */
+      USE_CHARSET (charset, LATIN_ISO8859_2);
+      code = keysym & 0x7f;
+      break;
+    case 2: /* Latin3 */
+      USE_CHARSET (charset, LATIN_ISO8859_3);
+      code = keysym & 0x7f;
+      break;
+    case 3: /* Latin4 */
+      USE_CHARSET (charset, LATIN_ISO8859_4);
+      code = keysym & 0x7f;
+      break;
+    case 4: /* Katakana */
+      USE_CHARSET (charset, KATAKANA_JISX0201);
+      if ((keysym & 0xff) > 0xa0)
+	code = keysym & 0x7f;
+      break;
+    case 5: /* Arabic */
+      USE_CHARSET (charset, ARABIC_ISO8859_6);
+      code = keysym & 0x7f;
+      break;
+    case 6: /* Cyrillic */
+      {
+	static UExtbyte const cyrillic[] = /* 0x20 - 0x7f */
+	{0x00, 0x72, 0x73, 0x71, 0x74, 0x75, 0x76, 0x77,
+	 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x00, 0x7e, 0x7f,
+	 0x70, 0x22, 0x23, 0x21, 0x24, 0x25, 0x26, 0x27,
+	 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x00, 0x2e, 0x2f,
+	 0x6e, 0x50, 0x51, 0x66, 0x54, 0x55, 0x64, 0x53,
+	 0x65, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e,
+	 0x5f, 0x6f, 0x60, 0x61, 0x62, 0x63, 0x56, 0x52,
+	 0x6c, 0x6b, 0x57, 0x68, 0x6d, 0x69, 0x67, 0x6a,
+	 0x4e, 0x30, 0x31, 0x46, 0x34, 0x35, 0x44, 0x33,
+	 0x45, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e,
+	 0x3f, 0x4f, 0x40, 0x41, 0x42, 0x43, 0x36, 0x32,
+	 0x4c, 0x4b, 0x37, 0x48, 0x4d, 0x49, 0x47, 0x4a};
+	USE_CHARSET (charset, CYRILLIC_ISO8859_5);
+	code = cyrillic[(keysym & 0x7f) - 0x20];
+	break;
+      }
+    case 7: /* Greek */
+      {
+	static UExtbyte const greek[] = /* 0x20 - 0x7f */
+	{0x00, 0x36, 0x38, 0x39, 0x3a, 0x5a, 0x00, 0x3c,
+	 0x3e, 0x5b, 0x00, 0x3f, 0x00, 0x00, 0x35, 0x2f,
+	 0x00, 0x5c, 0x5d, 0x5e, 0x5f, 0x7a, 0x40, 0x7c,
+	 0x7d, 0x7b, 0x60, 0x7e, 0x00, 0x00, 0x00, 0x00,
+	 0x00, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
+	 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
+	 0x50, 0x51, 0x53, 0x00, 0x54, 0x55, 0x56, 0x57,
+	 0x58, 0x59, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	 0x00, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
+	 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
+	 0x70, 0x71, 0x73, 0x72, 0x74, 0x75, 0x76, 0x77,
+	 0x78, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+	USE_CHARSET (charset, GREEK_ISO8859_7);
+	code = greek[(keysym & 0x7f) - 0x20];
+	break;
+      }
+    case 8: 
+      USE_UNICODE_MAP(keysym, TECHNICAL);
+      break;
+    case 9: 
+      USE_UNICODE_MAP(keysym, SPECIAL);
+      break;
+    case 10:
+      USE_UNICODE_MAP(keysym, PUBLISHING);
+      break;
+    case 11:
+      USE_UNICODE_MAP(keysym, APL);
+      break;
+    case 12: /* Hebrew */
+      USE_CHARSET (charset, HEBREW_ISO8859_8);
+      code = keysym & 0x7f;
+      break;
+    case 13: /* Thai */
+      /* #### This needs to deal with character composition.
+                  Are you sure we can't leave it to the X server? */
+      USE_CHARSET (charset, THAI_TIS620);
+      code = keysym & 0x7f;
+      break;
+    case 14: /* Korean Hangul. Would like some information on whether this
+		is worth doing--there don't appear to be any Korean keyboard
+		layouts in the XKB data files. */
+      break;
+
+    case 19: /* Latin 9 - ISO8859-15. */
+      USE_CHARSET (charset, LATIN_ISO8859_15);
+      code = keysym & 0x7f;
+      break;
+    case 32: /* Currency. The lower sixteen bits of these keysyms happily
+		correspond exactly to the Unicode code points of the
+		associated characters */
+      return Funicode_to_char(make_int(keysym & 0xffff), Qnil);
+      break;
+    default:
+      break;
+    }
+
+  if (code == 0)
+    return Qnil;
+
+#ifdef MULE
+  return make_char (make_ichar (charset, code, 0));
+#else
+  return make_char (code + 0x80);
+#endif
+}
+
+#endif /* defined(THIS_IS_X) || !defined(__GDK_KEYS_H__) */
--- a/src/events.c	Sat Jun 25 21:51:12 2005 +0000
+++ b/src/events.c	Sun Jun 26 18:05:05 2005 +0000
@@ -67,7 +67,7 @@
 Lisp_Object Qprocess_event_p;
 
 Lisp_Object Qkey_press, Qbutton_press, Qbutton_release, Qmisc_user;
-Lisp_Object Qascii_character;
+Lisp_Object Qcharacter_of_keysym, Qascii_character;
 
 
 /************************************************************************/
@@ -1196,7 +1196,6 @@
    define-key, which must be able to handle all consoles.  #### What about
    in other circumstances?  #### Should the user have access to this flag? 
 
-
    #### We need to go through and review all the flags in
    character_to_event() and event_to_character() and figure out exactly
    under what circumstances they should or should not be set, then go
@@ -1208,17 +1207,34 @@
    #### Some of this garbage, and some of the flags, could go away if we
    implemented the suggestion, originally from event-Xt.c:
 
-   #### The way that keysym correspondence to characters should work:
+   [[ The way that keysym correspondence to characters should work:
    - a Lisp_Event should contain a keysym AND a character slot.
    - keybindings are tried with the keysym.  If no binding can be found,
-     and there is a corresponding character, call self-insert-command.
+     and there is a corresponding character, call self-insert-command. ]]
+
+       That's an X-specific way of thinking. All the other platforms--even
+       the TTY, make sure you've done (set-input-mode t nil 1) and set your
+       console coding system appropriately when checking--just use
+       characters as emacs keysyms, and, together with defaulting to
+       self-insert-command if an unbound key with a character correspondence
+       is typed, that works fine for them. (Yes, this ignores GTK.)
+
+   [[  [... snipping other suggestions which I've implemented.]
+       Nuke the Qascii_character property. ]]
 
-   #### Nuke x-iso8859-1.el.
-   #### Nuke the Qascii_character property.
-   #### Nuke Vcharacter_set_property.
+       Well, we've renamed it anyway--it was badly named.
+       Qcharacter_of_keysym, here we go. It's really only with X11 that how
+       to map between adiaeresis and (int-to-char #xE4), or ellipsis and
+       whatever, becomes an issue, and IMO the property approach to this is
+       fine. Aidan Kehoe, 2005-05-15.
 
-   This would apparently solve a lot of different problems.
-*/
+   [[ This would apparently solve a lot of different problems. ]]
+
+      I'd be interested to know what's left. Removing the allow-meta
+      argument from event-to-character would be a Good Thing, IMO, but
+      beyond that, I'm not sure what else there is to do wrt. key
+      mappings. Of course, feedback from users of the Russian C-x facility
+      is still needed. */
 
 void
 character_to_event (Ichar c, Lisp_Event *event, struct console *con,
@@ -1294,21 +1310,10 @@
   SET_EVENT_KEY_MODIFIERS (event, m);
 }
 
-/* This variable controls what character name -> character code mapping
-   we are using.  Window-system-specific code sets this to some symbol,
-   and we use that symbol as the plist key to convert keysyms into 8-bit
-   codes.  In this way one can have several character sets predefined and
-   switch them by changing this.
-
-   #### This is utterly bogus and should be removed.
- */
-Lisp_Object Vcharacter_set_property;
-
 Ichar
 event_to_character (Lisp_Object event,
 		    int allow_extra_modifiers,
-		    int allow_meta,
-		    int map_device_key_names)
+		    int allow_meta)
 {
   Ichar c = 0;
   Lisp_Object code;
@@ -1319,25 +1324,42 @@
       return -1;
     }
   if (!allow_extra_modifiers &&
-      XEVENT_KEY_MODIFIERS (event) & (XEMACS_MOD_SUPER|XEMACS_MOD_HYPER|XEMACS_MOD_ALT))
+      XEVENT_KEY_MODIFIERS (event) & 
+      (XEMACS_MOD_SUPER|XEMACS_MOD_HYPER|XEMACS_MOD_ALT))
     return -1;
   if (CHAR_OR_CHAR_INTP (XEVENT_KEY_KEYSYM (event)))
     c = XCHAR_OR_CHAR_INT (XEVENT_KEY_KEYSYM (event));
   else if (!SYMBOLP (XEVENT_KEY_KEYSYM (event)))
     ABORT ();
-  else if (map_device_key_names && !NILP (Vcharacter_set_property)
-	   /* Allow window-system-specific extensibility of
-	      keysym->code mapping */
-	   && CHAR_OR_CHAR_INTP (code = Fget (XEVENT_KEY_KEYSYM (event),
-					      Vcharacter_set_property,
-					      Qnil)))
-    c = XCHAR_OR_CHAR_INT (code);
   else if (CHAR_OR_CHAR_INTP (code = Fget (XEVENT_KEY_KEYSYM (event),
-					   Qascii_character, Qnil)))
+					   Qcharacter_of_keysym, Qnil)))
     c = XCHAR_OR_CHAR_INT (code);
   else
-    return -1;
+    {
+      Lisp_Object thekeysym = XEVENT_KEY_KEYSYM (event);
+
+      if (CHAR_OR_CHAR_INTP (code = Fget (thekeysym, Qascii_character, Qnil)))
+	{
+	  extern Lisp_Object Qkey_mapping;
+
+	  c = XCHAR_OR_CHAR_INT (code);
+	  warn_when_safe(Qkey_mapping, Qwarning, 
+			 "Obsolete key binding technique.\n"
 
+"Some code you're using bound %s to `self-insert-command' and messed around\n"
+"with its `ascii-character' property.  Doing this is deprecated, and the code\n"
+"should be updated to use the `set-character-of-keysym' interface.\n"
+"If you're the one updating the code, first check if there's still a need\n"
+"for it; we support many more X11 keysyms out of the box now than we did\n"
+"in the past. ", XSTRING_DATA(XSYMBOL_NAME(thekeysym)));
+	  /* Only show the warning once for each keysym. */
+	  Fput(thekeysym, Qcharacter_of_keysym, code);
+	}
+      else
+	{
+	  return -1;
+	}
+    }
   if (XEVENT_KEY_MODIFIERS (event) & XEMACS_MOD_CONTROL)
     {
       if (c >= 'a' && c <= 'z')
@@ -1365,8 +1387,8 @@
   return c;
 }
 
-DEFUN ("event-to-character", Fevent_to_character, 1, 4, 0, /*
-Return the closest ASCII approximation to the given event object.
+DEFUN ("event-to-character", Fevent_to_character, 1, 3, 0, /*
+Return the closest character approximation to the given event object.
 If the event isn't a keypress, this returns nil.
 If the ALLOW-EXTRA-MODIFIERS argument is non-nil, then this is lenient in
  its translation; it will ignore modifier keys other than control and meta,
@@ -1376,24 +1398,16 @@
 If the ALLOW-META argument is non-nil, then the Meta modifier will be
  represented by turning on the high bit of the byte returned; otherwise, nil
  will be returned for events containing the Meta modifier.
-If the MAP-DEVICE-KEY-NAMES argument is non-nil, then named keysyms that
- represent printable characters will be converted to that character.  This
- means, for example, that under X, where a circumflexed lowercase o returns
- a key with the name `ocircumflex' rather than the actual character, this
- name will be converted to the appropriate character.  See
- `character-set-property' for some sense of how this works. #### This
- should not be exposed and may be removed at some point.
 Note that ALLOW-META may cause ambiguity between meta characters and
  Latin-1 characters.
 */
-     (event, allow_extra_modifiers, allow_meta, map_device_key_names))
+       (event, allow_extra_modifiers, allow_meta))
 {
   Ichar c;
   CHECK_LIVE_EVENT (event);
   c = event_to_character (event,
 			  !NILP (allow_extra_modifiers),
-			  !NILP (allow_meta),
-			  !NILP (map_device_key_names));
+			  !NILP (allow_meta));
   return c < 0 ? Qnil : make_char (c);
 }
 
@@ -2613,6 +2627,7 @@
   DEFSYMBOL (Qbutton_press);
   DEFSYMBOL (Qbutton_release);
   DEFSYMBOL (Qmisc_user);
+  DEFSYMBOL (Qcharacter_of_keysym);
   DEFSYMBOL (Qascii_character);
 
   defsymbol (&QKbackspace, "backspace");
@@ -2634,16 +2649,4 @@
 void
 vars_of_events (void)
 {
-  DEFVAR_LISP ("character-set-property", &Vcharacter_set_property /*
-This is used to map e.g. `ocircumflex' to the appropriate character under X.
-This value of this variable (a symbol, normally `x-iso8859-1' if not nil)
-if used to look up a property on the keysym in question, which should
-correspond to a character.
-
-#### This is way bogus and will be removed soon.
-
-The conversion between X keysyms and characters is now handled more or less
-automatically using XDisplayKeycodes().
-*/ );
-  Vcharacter_set_property = Qnil;
 }
--- a/src/events.h	Sat Jun 25 21:51:12 2005 +0000
+++ b/src/events.h	Sun Jun 26 18:05:05 2005 +0000
@@ -108,8 +108,6 @@
 #define first_event_type empty_event
 #define last_event_type dead_event
 
-#ifdef MULE
-
 enum alternative_key_chars
 {
   KEYCHAR_CURRENT_LANGENV,
@@ -122,8 +120,6 @@
   KEYCHAR_LAST
 };
 
-#endif /* MULE */
-
 struct Lisp_Key_Data
 {
 #ifdef EVENT_DATA_AS_OBJECTS
@@ -135,7 +131,6 @@
      Also includes buttons.  For many keys, Shift is not a bit; that
      is implicit in the keyboard layout. */
   int modifiers;
-#ifdef MULE
   /* Alternate character interpretations for this key in different
      keyboard layouts.  This deals with the problem of pressing C-x in
      the Russian layout (the so-called "Russian C-x problem"), for
@@ -149,12 +144,38 @@
      (AZERTY layout) who temporarily switches to Russian: The virtual
      keys underlying Russian are US-ASCII, so what the French speaker
      things of as C-a (the key just to the right of TAB) appears as
-     C-q. (#### We should probably ignore the current char and look
+     C-q. 
+
+         I've just implemented this in event-stream.c, and I really want to
+         see feedback from actual Russians about it, and whether it needs to
+         be much more complete than what I've done. E.g, the mapping back to
+         US Qwerty is hardcoded on the X11 side of things, and only deals
+         with the alphabetic characters. 
+
+	 Also, I think it's downright confusing for people with Roman
+	 letters on their keyboard to have random other letters than are
+	 described as calling some command, call that command. So I want to
+	 consider enabling it by language environment.
+
+     [[ (#### We should probably ignore the current char and look
      *ONLY* in alt_keychars for all control keys.  What about the
      English speaker who temporarily switches to the French layout and
-     finds C-q mapped to C-a?) */
+     finds C-q mapped to C-a?) ]] 
+
+         No, we shouldn't. People who use the French layout expect that
+         pressing control with the key to the right of tab passes C-a to
+         emacs; English speakers (more exactly, Qwerty users) who
+         temporarily switch to the French layout encounter that issue in
+         every other app too, and they normally remap the keyboard in
+         software as soon as they can, or learn to live with Azerty. That
+         applies for all the Roman-alphabet keyboard layouts. Aidan Kehoe,
+         2005-05-15
+
+         I've taken out the dependency on MULE for this feature because it's
+         also useful in a non-Mule XEmacs where the user has set their font
+         to something ending in iso8859-5. How many of those users there
+         are, is another question. */
   Ichar alt_keychars[KEYCHAR_LAST];
-#endif /* MULE */
 };
 
 typedef struct Lisp_Key_Data Lisp_Key_Data;
@@ -949,7 +970,7 @@
    (keyboard press, menu, scrollbar, mouse button) */
 int command_event_p (Lisp_Object event);
 void define_self_inserting_symbol (Lisp_Object, Lisp_Object);
-Ichar event_to_character (Lisp_Object, int, int, int);
+Ichar event_to_character (Lisp_Object, int, int);
 struct console *event_console_or_selected (Lisp_Object event);
 void upshift_event (Lisp_Object event);
 void downshift_event (Lisp_Object event);
--- a/src/keymap.c	Sat Jun 25 21:51:12 2005 +0000
+++ b/src/keymap.c	Sun Jun 26 18:05:05 2005 +0000
@@ -1586,7 +1586,7 @@
      Fcharacter_to_event() will only match 'escape'. */
   if (CHAR_OR_CHAR_INTP (key_specifier))
     return (XCHAR_OR_CHAR_INT (key_specifier)
-	    == event_to_character (event, 0, 0, 0));
+	    == event_to_character (event, 0, 0));
 
   /* Otherwise, we cannot call event_to_character() because we may
      be dealing with non-ASCII keystrokes.  In any case, if I ask
@@ -1609,8 +1609,8 @@
     {
       int ch1, ch2;
 
-      ch1 = event_to_character (event, 0, 0, 0);
-      ch2 = event_to_character (event2, 0, 0, 0);
+      ch1 = event_to_character (event, 0, 0);
+      ch2 = event_to_character (event2, 0, 0);
       retval = (ch1 >= 0 && ch2 >= 0 && ch1 == ch2);
     }
   else if (EQ (XEVENT_KEY_KEYSYM (event), XEVENT_KEY_KEYSYM (event2)) &&
@@ -1810,10 +1810,10 @@
 on the keys on your keyboard.
 
 A keysym may be represented by a symbol, or (if and only if it is equivalent
-to an ASCII character in the range 32 - 255) by a character or its equivalent
-ASCII code.  The `A' key may be represented by the symbol `A', the character
-`?A', or by the number 65.  The `break' key may be represented only by the
-symbol `break'.
+to a character with a code in the range 32 - 255) by a character or its
+equivalent code.  The `A' key may be represented by the symbol `A', the
+character `?A', or by the number 65.  The `break' key may be represented
+only by the symbol `break'.
 
 A keystroke may be represented by a list: the last element of the list
 is the key (a symbol, character, or number, as above) and the
@@ -2912,6 +2912,8 @@
   int bit1, bit2;
   int sym1_p = 0;
   int sym2_p = 0;
+  extern Lisp_Object Qcharacter_of_keysym;
+
   obj1 = XCAR (obj1);
   obj2 = XCAR (obj2);
 
@@ -2920,12 +2922,12 @@
   bit1 = MODIFIER_HASH_KEY_BITS (obj1);
   bit2 = MODIFIER_HASH_KEY_BITS (obj2);
 
-  /* If either is a symbol with a character-set-property, then sort it by
+  /* If either is a symbol with a Qcharacter_of_keysym property, then sort it by
      that code instead of alphabetically.
      */
   if (! bit1 && SYMBOLP (obj1))
     {
-      Lisp_Object code = Fget (obj1, Vcharacter_set_property, Qnil);
+      Lisp_Object code = Fget (obj1, Qcharacter_of_keysym, Qnil);
       if (CHAR_OR_CHAR_INTP (code))
 	{
 	  obj1 = code;
@@ -2935,7 +2937,7 @@
     }
   if (! bit2 && SYMBOLP (obj2))
     {
-      Lisp_Object code = Fget (obj2, Vcharacter_set_property, Qnil);
+      Lisp_Object code = Fget (obj2, Qcharacter_of_keysym, Qnil);
       if (CHAR_OR_CHAR_INTP (code))
 	{
 	  obj2 = code;
@@ -3397,12 +3399,13 @@
 
   if (EVENTP (chr))
     {
-      Lisp_Object ch = Fevent_to_character (chr, Qnil, Qnil, Qt);
+      Lisp_Object ch = Fevent_to_character (chr, Qnil, Qnil);
       if (NILP (ch))
 	return
 	  signal_continuable_error
 	    (Qinvalid_argument,
-	     "character has no ASCII equivalent", Fcopy_event (chr, Qnil));
+	     "key has no character equivalent (that we know of)",
+	     Fcopy_event (chr, Qnil));
       chr = ch;
     }
 
@@ -4124,6 +4127,7 @@
 elide_next_two_p (Lisp_Object list)
 {
   Lisp_Object s1, s2;
+  extern Lisp_Object Qcharacter_of_keysym;
 
   if (NILP (XCDR (list)))
     return 0;
@@ -4143,7 +4147,7 @@
 
   if (SYMBOLP (s1))
     {
-      Lisp_Object code = Fget (s1, Vcharacter_set_property, Qnil);
+      Lisp_Object code = Fget (s1, Qcharacter_of_keysym, Qnil);
       if (CHAR_OR_CHAR_INTP (code))
 	{
 	  s1 = code;
@@ -4153,7 +4157,7 @@
     }
   if (SYMBOLP (s2))
     {
-      Lisp_Object code = Fget (s2, Vcharacter_set_property, Qnil);
+      Lisp_Object code = Fget (s2, Qcharacter_of_keysym, Qnil);
       if (CHAR_OR_CHAR_INTP (code))
 	{
 	  s2 = code;
@@ -4204,6 +4208,7 @@
 			     ? 256 : 160));
   int elided = 0;
   struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
+  extern Lisp_Object Qcharacter_of_keysym;
 
   keymap = get_keymap (keymap, 1, 1);
   describe_map_closure.partial = (partial ? Qsuppress_keymap : Qnil);
@@ -4244,7 +4249,7 @@
 	    buffer_insert_c_string (buf, "Sh-");
 	  if (SYMBOLP (keysym))
 	    {
-	      Lisp_Object code = Fget (keysym, Vcharacter_set_property, Qnil);
+	      Lisp_Object code = Fget (keysym, Qcharacter_of_keysym, Qnil);
 	      Ichar c = (CHAR_OR_CHAR_INTP (code)
 			  ? XCHAR_OR_CHAR_INT (code) : (Ichar) -1);
 	      /* Calling Fsingle_key_description() would cons more */
--- a/src/lisp.h	Sat Jun 25 21:51:12 2005 +0000
+++ b/src/lisp.h	Sun Jun 26 18:05:05 2005 +0000
@@ -4305,7 +4305,7 @@
 
 /* Defined in events.c */
 EXFUN (Fcopy_event, 2);
-EXFUN (Fevent_to_character, 4);
+EXFUN (Fevent_to_character, 3);
 
 void clear_event_resource (void);
 Lisp_Object allocate_event (void);
--- a/src/sysdep.c	Sat Jun 25 21:51:12 2005 +0000
+++ b/src/sysdep.c	Sun Jun 26 18:05:05 2005 +0000
@@ -1602,7 +1602,7 @@
   if (CONSOLE_TTY_DATA (con)->controlling_terminal)
     {
       tty.main.c_cc[VINTR] = /* C-g (usually) gives SIGINT */
-	event_to_character (CONSOLE_QUIT_EVENT (con), 0, 1, 0);
+	event_to_character (CONSOLE_QUIT_EVENT (con), 0, 1);
       /* Set up C-g for both SIGQUIT and SIGINT.
 	 We don't know which we will get, but we handle both alike
 	 so which one it really gives us does not matter.  */
@@ -1696,7 +1696,7 @@
   /* Note: if not using CBREAK mode, it makes no difference how we
      set this */
   tty.tchars = new_tchars;
-  tty.tchars.t_intrc = event_to_character (CONSOLE_QUIT_EVENT (con), 0, 1, 0);
+  tty.tchars.t_intrc = event_to_character (CONSOLE_QUIT_EVENT (con), 0, 1);
   if (TTY_FLAGS (con).flow_control)
     {
       tty.tchars.t_startc = '\021';