Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!husc6!cmcl2!philabs!briar!mct From: mct@briar.UUCP (Mark C. Tucker) Newsgroups: net.emacs Subject: Creating new keymaps in GNU Message-ID: <312@briar.UUCP> Date: Wed, 20-Aug-86 14:41:59 EDT Article-I.D.: briar.312 Posted: Wed Aug 20 14:41:59 1986 Date-Received: Thu, 21-Aug-86 04:09:09 EDT Organization: Philips Laboratories, Briarcliff Manor, NY Lines: 35 ;;; ;;; New prefix chars ;;; ;; This code shows how to make ^w a command prefix. ;; ;; First we create a keymap to hold the keybindings to use ;; once you get to ^w from the keyboard. ;; ;; Then we create a "function" whose body is a keymap, instead ;; of a lambda expression. This is a piece of magic that I don't understand. ;; ;; Finally we set ^W to this "function" in the primary key map. This lets ;; the leading ^W trap to the keymap, instead of to "kill-region". ;; ;; Then, for grins, we put "kill-region" on ^w^w. ;;; C-W commands (defvar ctl-w-map (make-keymap) "Keymap for subcommands of C-W") (fset 'ctl-w-prefix ctl-w-map) (define-key global-map "\^W" 'ctl-w-prefix) (define-key ctl-w-map "\^w" 'kill-region) ;; This code redefines ^q to be the help prefix ;; and makes escape q be the usual quote character. ;; Then it lets ^h do the nice backward delete that expands tabs ;;; Help and C-H and vanilla (setq help-char 17) (define-key global-map "\^q" help-map) (define-key esc-map "q" 'quoted-insert) (define-key global-map "\^h" 'backward-delete-char-untabify)