[gnu.emacs] keyboard-translate-table

merlyn@intelob.intel.com (Randal L. Schwartz @ Stonehenge) (04/17/89)

In article <49058@aero.ARPA>, srt@aero (Scott "CBS" Turner) writes:
| The keyboard on my home computer has the single quote key where the
| ESC key should be (on the upper left) and the ESC key on the numeric
| keypad.  Needless to say, I find this fairly annoying.
| 
| Is there any way in Gnu Emacs to switch the bindings of these two keys
| so that hitting the single quote key becomes *exactly the same* as
| hitting the (normal) ESC key and the ESC key becomes the single quote
| key?  Binding esc-map to the single quote seems to work, but getting
| ESC to insert a single quote seems to be beyond my abilities.
| 
| I'd prefer something that works in all modes, needless to say.  It
| seems as if Gnu Emacs should have some kind of initial key mapping -
| ie., ascii codes to key names, but if it does I don't know about it.

Needless to say (:-), the same solution that attacks BS vs. RUBOUT
works on your problem, to wit:

(let ((ktt (make-string 128 0))
      (i 0))
  (while (< i 128)
    (aset ktt i i)
    (setq i (1+ i)))
  (aset ktt ?' ?\e)
  (aset ktt ?\e ?')
  (setq keyboard-translate-table ktt))

Of course, I am probably only one of the twelve people that is typing
in this solution at this particular moment.  Just wait for the rest of
the followups.... :-)
-- 
/=====Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095========\
{        on contract to BiiN (for now :-) Hillsboro, Oregon, USA.             }
{<@intel-iwarp.arpa:merlyn@intelob.intel.com> ...!uunet!tektronix!biin!merlyn }
\=====Cute quote: "Welcome to Oregon... home of the California Raisins!"======/