Path: utzoo!utgpu!water!watmath!clyde!att!rutgers!mit-eddie!silvlis.COM!mdb From: mdb@silvlis.COM (Mark D. Baushke) Newsgroups: comp.emacs Subject: Re: terminal sends 3 chars for meta key Message-ID: <8810152200.AA13026@amadeus.silvlis.com> Date: 16 Oct 88 00:50:38 GMT Sender: nessus@eddie.MIT.EDU Organization: Silvar-Lisco, 1080 Marsh Road, Menlo Park, CA 94025-1053 Lines: 72 > Date: 15 Oct 88 15:17:55 GMT > From: sun!rutgers.edu!mailrus!b-tech!zeeff (Jon Zeeff) > > I just started using emacs and I'd like to use the meta key on this > terminal. Unfortunately, this key send ESC N key (ie. pressing M-A sends > NA). Is there a way to get emacs to ignore that extra N sent between > the esc and the A? Try putting the following "magic" into your .emacs file. ;---------- make ESC N behave like ESC ---------- ;; Note the following should probably be done inside a ;; lisp/term/.el file rather than in your .emacs file. ;; Some versions of copy-keymap don't recurse to all levels. (defun deep-copy-keymap (keymap) "Return a deep copy of KEYMAP. That is, all levels are copied, not just the top level." (if (not (keymapp keymap)) keymap (cond ((listp keymap) (let ((new-keymap (copy-alist keymap))) (setq keymap (cdr new-keymap)) (while keymap (let ((binding (car keymap))) (if (keymapp (cdr binding)) (setcdr binding (deep-copy-keymap (cdr binding)))) ) (setq keymap (cdr keymap)) ) new-keymap )) ((vectorp keymap) (let ((i 0) (n (length keymap)) (new-keymap (copy-sequence keymap))) (while (< i n) (if (keymapp (aref keymap i)) (aset new-keymap i (deep-copy-keymap (aref keymap i)))) (setq i (1+ i))) new-keymap ))))) ;; Create a copy of the esc-map which can be bound to the N key. (setq esc-n-map (deep-copy-keymap esc-map)) ;; Install the key map. (define-key esc-map "N" esc-n-map) ;;!; Alternative to last two lisp statements above would be given the ;;!; name of the terminal type which has the ESC N problem is is ;;!; "footype" then: ;;!; ;;!; (if (string= (getenv "TERM") "footype") ;;!; (progn ;;!; ;; Create a copy of the esc-map which can be bound to the N key. ;;!; (setq esc-n-map (deep-copy-keymap esc-map)) ;;!; ;;!; ;; Install the key map. ;;!; (define-key esc-map "N" esc-n-map))) Enjoy! ------------------------------------------------------------------------------ Mark D. Baushke Internet: mdb%silvlis.com@sun.com Silvar-Lisco, Inc. Nameservers: mdb@silvlis.com 1080 Marsh Road Usenet: {pyramid,sun}!silvlis!mdb Menlo Park, CA 94025-1053 Telephone: +1 415 853-6411 / +1 415 969-8328