Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!hpda!hpsal2!hpcupt1!hpindda!jack From: jack@hpindda.HP.COM (Jack Repenning) Newsgroups: comp.emacs Subject: Re: gnumacs bindings Message-ID: <3590002@hpindda.HP.COM> Date: Thu, 10-Sep-87 20:19:56 EDT Article-I.D.: hpindda.3590002 Posted: Thu Sep 10 20:19:56 1987 Date-Received: Sat, 12-Sep-87 18:03:28 EDT References: <3990001@hpesoc1.HP.COM> Organization: Hewlett Packard, Cupertino Lines: 129 > Some HP versions have "term/hp" which maps arrow keys, the Insert-line > key, Delete-char, and all of those guys to their Emacs functions. Jack > Repenning has a great one that maps more of those special keys to their > Gnu bindings than any other version, and his breaks fewer functions. > (Jack, how about posting your hp.el? And sending it to FSF?) This is hardly a one-man show (what is, when you're dealing with Emacs?), but I did touch it last, so here it is. Give it to FSF? I've no objections (nor, I imagine, would any of the other contributers) - just no time. I'll try to get around to it... Besides, I'm sure someone will improve it the minute they see it, so let *them* give it to FSF:-) Jack Repenning (jack@hpda.hp.com, (408) 447-3380) ******************************** cut here ******************************** ;;; term/hp.el - Makes HP terminal function keys work, interchanges ;;; DEL and BACKSPACE, and breaks as few other things as possible. ;;; Copyright (C) 1985, 1986, 1987 Free Software Foundation ;; GNU Emacs is distributed in the hope that it will be useful, but ;; without any warranty. No author or distributor accepts ;; responsibility to anyone for the consequences of using it or for ;; whether it serves any particular purpose or works at all, unless he ;; says so in writing. ;; Everyone is granted permission to copy, modify and redistribute GNU ;; Emacs, but only under the conditions described in the document "GNU ;; Emacs copying permission notice". An exact copy of the document is ;; supposed to have been given to you along with GNU Emacs so that you ;; can know how you may redistribute it all. It should be in a file ;; named COPYING. Among other things, the copyright notice and this ;; notice must be preserved on all copies. ;;; HP terminals usually encourage using ^H as the rubout character. ;;; Map HP function key escape sequences into the standard slots in ;;; function-keymap. (require 'keypad) (let ((the-table (make-string 128 0))) (let ((i 0)) (while (< i 128) (aset the-table i i) (setq i (1+ i)))) (aset the-table ?\177 ?\^h) ;; Swap ^H and DEL (aset the-table ?\^h ?\177) ;; Swap ^H and DEL (setq keyboard-translate-table the-table)) ;;; Define some functions used by the arrow keys -- ;;; A popular use for "clear display" (although this file binds it to ;;; delete-other-windows). ;;; Another popular use is recenter. (defun kill-to-end-of-file () "Kill from point to end-of-file." (interactive) (kill-region (point) (point-max))) (defun scroll-down-by-lines (arg) "Scroll down the screen ARG lines (default: 1)." (interactive "p") (scroll-down arg)) (defun scroll-up-by-lines (arg) "Scroll up the screen ARG lines (default: 1)." (interactive "p") (scroll-up arg)) (defun delete-line() "Delete the current line into the kill-buffer. Set the point at the start of the line following the deleted one." (interactive "*") (beginning-of-line) (kill-line 1)) (defun insert-line () "Insert blank line before current line and place cursor at beginning." (interactive) (beginning-of-line) (open-line 1)) ;;; -- Local preferences to the Gnu versions -- (define-key function-keymap "A" 'insert-line) (define-key function-keymap "C" 'delete-other-windows) (define-key function-keymap "D" 'delete-char) (define-key function-keymap "E" 'kill-line) (define-key function-keymap "F" 'scroll-down-by-lines) (define-key function-keymap "I" 'overwrite-mode) (define-key function-keymap "L" 'delete-line) (define-key function-keymap "R" 'scroll-up-by-lines) (define-key function-keymap "" 'beginning-of-buffer) (define-key function-keymap "" 'end-of-buffer) (defun enable-arrow-keys () "Enable the use of the HP arrow keys for cursor motion. Defeats bindings of mark-paragraph and transpose-words" (interactive) (setup-terminal-keymap esc-map '( ( "A". ?u) ; up-arrow ( "B". ?d) ; down-arrow ( "C". ?r) ; right-arrow ( "D". ?l) ; left-arrow ( "F". ?) ; - ( "J". ?C) ; ( "K". ?E) ; ( "L". ?A) ; ( "M". ?L) ; ( "N". ?I) ; - ( "O". ?D) ; - ( "P". ?D) ; ( "Q". ?I) ; ( "R". ding) ; ??? ( "S". ?R) ; ( "T". ?F) ; ( "U". ?N) ; ( "V". ?P) ; ( "h". ?) ;; WAS mark-paragraph ) )) (enable-arrow-keys) ******************************** end ********************************