Xref: utzoo gnu.emacs.help:1301 comp.emacs:10205 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!apple!agate!ucbvax!tut.cis.ohio-state.edu!unreplyable!garbage From: mal@coyote.draper.com (Mark Lamourine) Newsgroups: gnu.emacs.help,comp.emacs Subject: (none) Message-ID: <9102281451.AA04180@coyote.draper.com> Date: 28 Feb 91 14:51:01 GMT Sender: daemon@tut.cis.ohio-state.edu Followup-To: gnu.emacs.help Organization: Gatewayed from the GNU Project mailing list help-gnu-emacs@prep.ai.mit.edu Lines: 67 's message of 19 Feb 91 18:58:33 GMT <2773@texsun.Central.Sun.COM> Subject: Multiple Key Binding Need Help Greg George writes: > Dudes; > I need to find a way to bind several keys (4 or 5) > to a emacs command. On the sun keyboard, many of the function > keys return multiple characters. I can get two keystrokes > to bind, but can't figure out how to get many. Try placing this in your ~/.emacs file. It works for me. ---- snip ----- ; emacs script by David Oh (May 1990) ; based on script by John Carr on project Athena at MIT (Feb, 1989) ; on Sun Workstations (sparcs 1) the function and special keys emit "ESC [ string" ; the various keys map to different strings. For instance: ; F1 224z ; F2 225z ; up arrow A ; down arrow B ; etc.... ; First, define an empty keymap to hold the bindings. (defvar fnkey-map (make-sparse-keymap) "Keymap for Function Keys" ) ;Second, bind it to ESC- [ (which is the prefix used on the function keys (define-key esc-map "[" fnkey-map) ; Third, bind functions to the various keys. Note that you must use ; internal lisp function names, which are usually but not always the ; names used with meta-x. ; You can get them using ctrl-h k or a ; definitions for the number pad *on the right* (define-key fnkey-map "A" 'previous-line) ; the up arrow (define-key fnkey-map "B" 'next-line) ; the down arrow (define-key fnkey-map "C" 'forward-char) ; the right arrow (define-key fnkey-map "D" 'backward-char) ; the left arrow (define-key fnkey-map "216z" 'scroll-down) ; the PgUp key (define-key fnkey-map "222z" 'scroll-up) ; the PgDn key (define-key fnkey-map "214z" 'beginning-of-buffer) ; the Home key (define-key fnkey-map "220z" 'end-of-buffer) ; the End key (define-key fnkey-map "218z" 'recenter) ; centers page ; definitions for the command pad *on the left* (define-key fnkey-map "195z" 'undo) ; the Undo key (define-key fnkey-map "197z" 'copy-region-as-kill) ; the Copy key (define-key fnkey-map "199z" 'yank) ; the Paste key (define-key fnkey-map "200z" 'query-replace) ; the find key (define-key fnkey-map "201z" 'kill-region) ; the Cut key (define-key fnkey-map "207z" 'command-apropos) ; the Help key ; definitions for the function keys * on top * (define-key fnkey-map "224z" 'comment-top) ; the F1 key (define-key fnkey-map "225z" 'comment-middle) ; the F2 key (define-key fnkey-map "226z" 'comment-formfeed) ; the F3 key (define-key fnkey-map "227z" 'c-mode) ; the F4 key (define-key fnkey-map "228z" 'overwrite-mode) ; the F5 key (define-key fnkey-map "229z" 'overwrite-mode) ; the F6 key (define-key fnkey-map "230z" 'overwrite-mode) ; the F7 key (define-key fnkey-map "231z" 'overwrite-mode) ; the F8 key (define-key fnkey-map "232z" 'overwrite-mode) ; the F9 key