home *** CD-ROM | disk | FTP | other *** search
-
- HP/ISI input remapping files: Part 7 of 8
-
- This is a complete copy of lisp/term/default_keymap.el, the
- default HP-specific keyboard setup. It contains four parts:
-
- 1. A copy of bobcat.el's logic to swap contro-H and ascii del.
- It's an artifact of history -- at one time I was expecting
- to replace bobcat.el with this.
-
- 2. A run of x-rebind-keysym invocations to bind a string of the
- form "^X^Ykeyname" to each "non-ascii" keysym. "keyname"
- is normally the string that X11 associates with each keysym.
- The exceptions marked by '****' comments prevent emacs from
- interpreting one keysym as a prefix for another.
-
- 3. A few functions are defined for use in the last part.
-
- 4. A run of global-set-key functions defines what each key does.
-
-
- It's also possible to just use x-rebind-keysym to map to
- "standard" emacs commands. However, there are a few pitfalls
- involving shift keys (as noted in connection with x11term.c),
- and using this technique on the first go-around produced a
- VERY cryptic elisp file that proved hard to maintain before
- its prototype was finished!
-
-
- ------------------------------ Cut Here --------------------------------
- ;;
- ;; HP function key rebindings for X11
- ;; 4-25-89 Paul Raveling
- ;;
-
- ;; The next section, which swaps control-H and ascii del, is
- ;; a verbatim copy of the original term/bobcat.el. All other
- ;; definitions and logic is
-
- ;;; HP terminals usually encourage using ^H as the rubout character
-
- (let ((the-table (make-string 128 0)))
- (let ((i 0))
- (while (< i 128)
- (aset the-table i i)
- (setq i (1+ i))))
- ;; Swap ^H and DEL
- (aset the-table ?\177 ?\^h)
- (aset the-table ?\^h ?\177)
- (setq keyboard-translate-table the-table))
-
-
-
- ;;;; Bind keysyms to escape sequences consistent with
- ;;;; the distributed version of emacs
-
- (x-rebind-keysym "Left" nil "Left")
- (x-rebind-keysym "Right" nil "Right") ; Arrow
- (x-rebind-keysym "Up" nil "Up") ; Keys
- (x-rebind-keysym "Down" nil "Down")
-
- (x-rebind-keysym "F1" nil "F1")
- (x-rebind-keysym "F2" nil "F2")
- (x-rebind-keysym "F3" nil "F3")
- (x-rebind-keysym "F4" nil "F4")
- (x-rebind-keysym "F5" nil "F5")
- (x-rebind-keysym "F6" nil "F6")
- (x-rebind-keysym "F7" nil "F7")
- (x-rebind-keysym "F8" nil "F8")
- (x-rebind-keysym "F9" nil "F9")
- (x-rebind-keysym "F10" nil "F10")
- (x-rebind-keysym "F11" nil "F11")
- (x-rebind-keysym "F12" nil "F12")
- (x-rebind-keysym "F13" nil "F13")
- (x-rebind-keysym "F14" nil "F14")
- (x-rebind-keysym "F15" nil "F15")
- (x-rebind-keysym "Help" nil "Help")
- (x-rebind-keysym "F16" nil "F16")
- (x-rebind-keysym "Menu" nil "Menu")
- (x-rebind-keysym "F17" nil "F17")
- (x-rebind-keysym "F18" nil "F18")
- (x-rebind-keysym "F19" nil "F19")
- (x-rebind-keysym "F20" nil "F20")
-
- (x-rebind-keysym "Find" nil "Find")
- (x-rebind-keysym "Insert" nil "Insert")
- ;;(x-rebind-keysym "Delete" nil "Delete_DEL")
- (x-rebind-keysym "Select" nil "Select")
- (x-rebind-keysym "Prior" nil "Prior")
- (x-rebind-keysym "Next" nil "Next")
-
-
- ;;;; Bind keysyms unused by distributed version of emacs
- ;;;; but used on HP keyboards to escape sequences
-
- (x-rebind-keysym "Tab" nil "Tab")
- (x-rebind-keysym "Tab_backward" nil "backward_Tab") ; ****
- (x-rebind-keysym "Execute" nil "Enter") ; Actually, enter
- (x-rebind-keysym "Print" nil "Print")
- (x-rebind-keysym "Break" nil "Break")
- (x-rebind-keysym "Reset" nil "Reset")
- (x-rebind-keysym "Cancel" nil "Cancel")
- (x-rebind-keysym "System" nil "System")
- (x-rebind-keysym "User" nil "User")
- (x-rebind-keysym "Clear_line" nil "Clear_line")
- (x-rebind-keysym "Clear" nil "Clear_display") ; ****
- (x-rebind-keysym "Insert_line" nil "Insert_line")
- (x-rebind-keysym "Delete_line" nil "Delete_line")
- (x-rebind-keysym "Insert_char" nil "Insert_char")
- (x-rebind-keysym "Delete_char" nil "Delete_char")
- (x-rebind-keysym "Home" "none" "Home")
- (x-rebind-keysym "Home" "shift" "Shift_Home")
- (x-rebind-keysym "KP_F1" nil "KP_F1")
- (x-rebind-keysym "KP_F2" nil "KP_F2")
- (x-rebind-keysym "KP_F3" nil "KP_F3")
- (x-rebind-keysym "KP_F4" nil "KP_F4")
- (x-rebind-keysym "KP_Multiply" nil "KP_Multiply")
- (x-rebind-keysym "KP_Divide" nil "KP_Divide")
- (x-rebind-keysym "KP_Add" nil "KP_Add")
- (x-rebind-keysym "KP_Subtract" nil "KP_Subtract")
- (x-rebind-keysym "KP_7" nil "KP_7")
- (x-rebind-keysym "KP_8" nil "KP_8")
- (x-rebind-keysym "KP_9" nil "KP_9")
- (x-rebind-keysym "KP_Enter" nil "KP_Enter")
- (x-rebind-keysym "KP_4" nil "KP_4")
- (x-rebind-keysym "KP_5" nil "KP_5")
- (x-rebind-keysym "KP_6" nil "KP_6")
- (x-rebind-keysym "KP_Separator" nil "KP_Separator")
- (x-rebind-keysym "KP_1" nil "KP_1")
- (x-rebind-keysym "KP_2" nil "KP_2")
- (x-rebind-keysym "KP_3" nil "KP_3")
- (x-rebind-keysym "KP_Tab" "none" "KP_Tab")
- (x-rebind-keysym "KP_Tab_backward" "shift" "KP_backward_Tab") ; ****
- (x-rebind-keysym "KP_0" nil "KP_0")
- (x-rebind-keysym "KP_Decimal" nil "KP_Decimal")
-
-
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; Simple non-standard functions to support key bindings ;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
- (defun delete-this-line ()
- "Delete current line, save as kill"
- (interactive)
- (let (curcol dot1)
- (setq curcol (current-column))
- (forward-line 0)
- (setq dot1 (dot))
- (forward-line 1)
- (kill-region dot1 (dot))
- (move-to-column curcol)))
-
- (defun clear-this-line ()
- "Delete contents of current line, save as kill"
- (interactive)
- (forward-line 0)
- (kill-line))
-
- (defun clear-entire-buffer ()
- "Delete contents of entire buffer, save as kill"
- (interactive)
- (mark-whole-buffer)
- (kill-region 1 (region-end)))
-
- (defun switch-to-prev-buffer ()
- "Switch to previous buffer: Like switch-to-buffer, but without interaction"
- (interactive)
- (switch-to-buffer (other-buffer (current-buffer))))
-
- (defun start-end-kbd-macro ()
- "Start/stop capturing keystrokes for keyboard macro"
- (interactive)
- (if defining-kbd-macro
- (end-kbd-macro)
- (start-kbd-macro nil)))
-
- (defun keys ()
- "Describe default HP key functions"
- (interactive)
- (view-file "/usr/local/gemacs-18.54/etc/HP_keys.text"))
-
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; Map specific escape sequences ;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
- (global-unset-key "\e[") ; Unmap escape-left-bracket
-
-
- ; Function key row along top of main cluster
-
- (global-set-key "Break" 'save-buffer) ; Break: Save buffer
- (global-set-key "Reset" 'revert-buffer) ; Reset: Revert buffer
- (global-set-key "Cancel" 'save-buffers-kill-emacs) ; Stop: Exit gracefully
-
- (global-set-key "F1" 'call-last-kbd-macro) ; f1: Execute macro
- (global-set-key "F2" 'start-end-kbd-macro) ; f2: Start/end macro def
- (global-set-key "F3" 'bury-buffer) ; f3: Switch to next buffer
- (global-set-key "F4" 'switch-to-prev-buffer); f4: Switch to prev buffer
- (global-set-key "Menu" 'list-buffers) ; Menu: Buffer menu
- (global-set-key "System" 'dired) ; System: 'Edit' directory
- (global-set-key "User" 'rmail) ; User: 'Edit' mail
- (global-set-key "F5" 'delete-other-windows) ; f5: Edit just 1 buffer
- (global-set-key "F6" 'replace-string) ; f6: Replace string
-
- ;; If not for searches recognizing ^s & ^r when parsing pattern:
- ;(global-set-key "F7" 'isearch-backward) ; f7: Search backward
- ;(global-set-key "F8" 'isearch-forward) ; f8: Search forward
- ;; But instead:
- (x-rebind-keysym "F7" nil "") ; f7: Search backward
- (x-rebind-keysym "F8" nil "") ; f8: Search forward
-
- (global-set-key "Clear_line" 'clear-this-line) ; Clear line: Clear line
- (global-set-key "Clear_display" 'clear-entire-buffer); Clear display: Clear buffer
-
-
-
- ; Special purpose keys in main key cluster
-
- ;;;(global-set-key "Tab" 'backward-kill-word) ; Tab: Delete word backward
- ;;;(global-set-key "backward_Tab" 'kill-word) ; Shift-Tab: Del word forward
- (global-set-key "Tab" 'tab-to-tab-stop) ; Tab: Tab forward
- (global-set-key "backward_Tab" 'tab-to-tab-stop) ; Shift-Tab: Same
- ;;(global-set-key "Delete_DEL" 'keyboard-quit); DEL: Abort command
- (global-set-key "Enter" 'find-file) ; Enter: Find file
- (global-set-key "Print" 'insert-file) ; Print: Insert file
-
- (global-set-key "Insert_line" 'open-line) ; Insert line: Split line
- (global-set-key "Delete_line" 'delete-this-line) ; Delete line: Del line
- (global-set-key "Insert_char" 'overwrite-mode); Insert char: Toggle ovrwrt
- (global-set-key "Delete_char" 'delete-char) ; Delete char: Delete char
- (global-set-key "Home" 'beginning-of-buffer); Home: Go to start of buffer
- (global-set-key "Shift_Home" 'end-of-buffer); Shift Home: Go to end of buf
- (global-set-key "Select" 'exchange-point-and-mark) ; Select: Retreat!
- (global-set-key "Prior" 'scroll-down) ; Prev: Scroll back 1 page
- (global-set-key "Next" 'scroll-up) ; Next: Scroll fwd 1 page
-
- (global-set-key "Left" 'backward-char) ; Left arrow: Move left
- (global-set-key "Right" 'forward-char) ; Left arrow: Move left
- (global-set-key "Up" 'previous-line) ; Left arrow: Move left
- (global-set-key "Down" 'next-line) ; Left arrow: Move left
-
-
-
- ; Keypad cluster
-
-
- ; Unmarked function keys on top row:
-
- (global-set-key "KP_F1" 'apropos) ; Keypad F1: Apropos
- (global-set-key "KP_F2" 'describe-key) ; Keypad F2: Describe key
- (global-set-key "KP_F3" 'describe-bindings) ; Keypad F3: Describe keys
- (global-set-key "KP_F4" 'describe-function) ; Keypad F4: Describe function
-
-
- ; Big keys:
-
- (global-set-key "KP_Tab" 'goto-line) ; Keypad Tab: Go to line [#]
- (global-set-key "KP_backward_Tab" 'what-line); Shift KP Tab: Report line #
- (global-set-key "KP_0" 'undo) ; Keypad 0: Undo
-
- ; Little keys: Mode settings
-
- (global-set-key "KP_Multiply" 'text-mode)
- (global-set-key "KP_Divide" 'indented-text-mode)
- (global-set-key "KP_Add" 'outline-mode)
- (global-set-key "KP_Subtract" 'fundamental-mode)
-
- (global-set-key "KP_7" 'c-mode)
- (global-set-key "KP_8" 'lisp-mode)
- (global-set-key "KP_9" 'emacs-lisp-mode)
- (global-set-key "KP_Enter" 'lisp-interaction-mode)
-
- (global-set-key "KP_4" 'latex-mode)
- (global-set-key "KP_5" 'plain-tex-mode)
- (global-set-key "KP_6" 'scribe-mode)
- (global-set-key "KP_Separator" 'nroff-mode)
-
- (global-set-key "KP_1" 'copy-region-as-kill)
- (global-set-key "KP_2" 'kill-region)
- (global-set-key "KP_3" 'yank)
- (global-set-key "KP_Decimal" 'set-mark-command)
-
-
-