Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!columbia!rutgers!clyde!cbosgd!cblpf!cbstr1!Karl.Kleinpaste From: Karl.Kleinpaste@cbstr1.att.com Newsgroups: comp.emacs Subject: If you REALLY don't like the arrangement of C-h and DEL in GNU... Message-ID: <247@cbstr1.att.com> Date: Thu, 28-May-87 16:14:15 EDT Article-I.D.: cbstr1.247 Posted: Thu May 28 16:14:15 1987 Date-Received: Sun, 21-Jun-87 10:48:52 EDT Sender: karl@cbstr1.att.com Lines: 57 Keywords: keyboard-translate-table Summary: Here's how to interchange them. Posting-Front-End: GNU Emacs 18.44.1 of Mon May 18 1987 on cbstr1 (usg-unix-v) I have been asked this question 4 times in the last 2 weeks. Many people are used to typing C-h as a delete-backward-char (aka, "stty erase") and tend to use DEL as a SIGINT key. SysV users in particular have this tendency. Fine. Except GNU Emacs has a really serious prejudice toward C-h as the Help character, and DEL as delete-backward-char. Ecumenical differences abound. Religious wars begin. Yes, one could ask that SysV users (and all who have the tendency to use C-h for stty erase and DEL as SIGINT) to convert to using DEL and C-c, respectively. I converted just so, about 2 years ago. But that's really just another religious war. Many people seem not to be aware of a very valuable variable inside GNU Emacs called the keyboard-translate-table. When you type any char at GNU Emacs, GNU Emacs takes its ASCII value as index into this string, takes the char found there, and substitutes as though you'd typed that instead. This variable's existence allows the use of: (setq keyboard-translate-table "\000\001\002\003\004\005\006\007 \177\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027 \030\031\032\033\034\035\036\037 !\042#$%&'()*+,-./0123456789:;< =>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\134]^_`abcdefghijklmnopqrstuvwxy z{|}~\010") which you can put in your .emacs file. This has the effect of interchanging all uses of C-h and DEL after the execution of the setq. (Note that the string should all be on one line; I broke it into pieces to prevent mailer/rnews stupidity.) Note that the position where \010 ought to be has \177 in it, and conversely. This translation happens at a very low level inside GNU Emacs. It is so low that, when you type C-h after executing the setq, GNU Emacs will *think* you've typed DEL. When you type DEL, GNU Emacs will think you typed C-h. Hit 2 DELs and you'll get the minibuffer help menu. Hit a 3rd DEL and you'll get the full-buffer help menu. Ask GNU Emacs to describe-key-briefly on C-h, and it'll tell you that DEL runs the command delete-backward-char. You get the idea. So you can avoid all the ecumenical and religious problems associated with The Right Way To Set Up Your Terminal with simple, judicious use of the keyboard-translate-table. (I know a person who uses k-t-t to interchange the use of C-g and C-u - icktooey - dangerous magic.) This works far better than a mess of global-set-key commands because it can't be fubar'd by some major mode coming along and screwing around with your keymaps. k-t-t conversion happens before keymap interpretations. Try it out and see if it prevents an argument with your officemate about The Proper Use of DEL. Enjoy, Karl