| 1 |
;; macros to go with oemacs |
| 2 |
|
| 3 |
; suntool-map is the map for "\C-x*", the oemacs prefix for function keys |
| 4 |
; commented-out lines agree with the settings in $(EMACS)/lisp/term/sun.el |
| 5 |
|
| 6 |
(setq suntool-map-hooks '( ; not your usual hook list |
| 7 |
; (define-key suntool-map "al" 'keyboard-quit) ; Stop |
| 8 |
; (define-key suntool-map "bl" 'redraw-display) ; Again L2 |
| 9 |
; (define-key suntool-map "b\M-l" 'repeat-complex-command); M-Again = C-X ESC |
| 10 |
; (define-key repeat-complex-command-map "\C-x*b\M-l" |
| 11 |
; 'previous-complex-command) ; M-Again M-Again... |
| 12 |
(define-key suntool-map "bL" 'rerun-prev-command) ; AGAIN (no confirm) |
| 13 |
; (define-key suntool-map "b\M-L" 'rerun-prev-command) ; M-AGAIN |
| 14 |
; (define-key suntool-map "cl" 'buffer-menu) ; Props |
| 15 |
; (define-key suntool-map "dl" 'undo) ; Undo |
| 16 |
; (define-key suntool-map "el" 'ignore-key) ; Front |
| 17 |
; (define-key suntool-map "fl" 'sun-select-region) ; Copy |
| 18 |
; (define-key suntool-map "f," 'copy-region-as-kill) ; C-Copy |
| 19 |
; (define-key suntool-map "gl" 'ignore-key) ; Open |
| 20 |
; (define-key suntool-map "hl" 'sun-yank-selection) ; Paste |
| 21 |
; (define-key suntool-map "h," 'yank) ; C-Paste |
| 22 |
; (define-key suntool-map "il" 'research-forward) ; Find (with default) |
| 23 |
; (define-key suntool-map "i\M-l" 'research-backward) ; M-Find |
| 24 |
; (define-key suntool-map "iL" 'isearch-forward-regexp) ; FIND (incremental) |
| 25 |
; (define-key suntool-map "i\M-L" 'isearch-backward-regexp); M-FIND |
| 26 |
; (define-key suntool-map "i," 're-search-forward) ; C-Find (ordinary) |
| 27 |
; (define-key suntool-map "i\M-," 're-search-backward) ; C-M-Find |
| 28 |
(define-key suntool-map "jl" 'sun-cut-region) ; Cut |
| 29 |
(define-key suntool-map "j," 'kill-region-and-unmark) ; C-Cut |
| 30 |
(define-key suntool-map "jL" 'pop-the-mark) ; CUT |
| 31 |
; (define-key suntool-map "j\M-l" 'exchange-point-and-mark); M-Cut |
| 32 |
|
| 33 |
(define-key suntool-map "at" 'bury-buffer) ; F1 |
| 34 |
; (define-key suntool-map "bt" 'toggle-selective-display) ; F2 |
| 35 |
; (define-key suntool-map "ct" 'scroll-down-in-place) ; F3 |
| 36 |
; (define-key suntool-map "cT" '(lambda(n) (interactive "p") (scroll-down n))) |
| 37 |
; (define-key suntool-map "dt" 'scroll-up-in-place) ; F4 |
| 38 |
; (define-key suntool-map "dT" '(lambda(n) (interactive "p") (scroll-up n))) |
| 39 |
(define-key suntool-map "et" 'jumpup) ; F5 |
| 40 |
; (define-key suntool-map "ft" 'shrink-window) ; F6 |
| 41 |
; (define-key suntool-map "fT" 'shrink-window-horizontally) ; Shift-F6 |
| 42 |
; (define-key suntool-map "gt" 'enlarge-window) ; F7 |
| 43 |
; (define-key suntool-map "gT" 'enlarge-window-horizontally) ; Shift-F7 |
| 44 |
(define-key suntool-map "ht" 'tags-search) ; F8 |
| 45 |
(define-key suntool-map "it" 'tags-query-replace) ; F9 |
| 46 |
(define-key suntool-map "jt" 'narrow-to-region) ; F10 |
| 47 |
(define-key suntool-map "j\M-t" 'narrow-to-page) ; M-F10 |
| 48 |
(define-key suntool-map "kt" 'revert-buffer) ; F11 |
| 49 |
(define-key suntool-map "k\M-t" 'quick-revert-other-buffer) ; M-F11 |
| 50 |
(define-key suntool-map "lt" 'goto-line) ; F12 |
| 51 |
(define-key suntool-map "l\M-t" 'goto-line) ; M-F12 |
| 52 |
|
| 53 |
(define-key suntool-map "ar" 'redraw-display) ; Pause, R1 |
| 54 |
(define-key suntool-map "br" 'call-secondlast-kbd-macro) ; PrSc, R2 |
| 55 |
(define-key suntool-map "cr" 'ignore-key) ; Scroll Lock Break, R3 |
| 56 |
(define-key suntool-map "dr" 'unbound-key) ; KP=, R4 |
| 57 |
(define-key suntool-map "d\M-r" 'bind-last-kbd-macro-to-KP=) ; M-KP=, M-R4 |
| 58 |
(define-key suntool-map "er" 'unbound-key) ; KP/, R5 |
| 59 |
(define-key suntool-map "e\M-r" 'bind-last-kbd-macro-to-KP/) ; M-KP/, M-R5 |
| 60 |
(define-key suntool-map "fr" 'unbound-key) ; KP*, R6 |
| 61 |
(define-key suntool-map "f\M-r" 'bind-last-kbd-macro-to-KP*) ; M-KP*, M-R6 |
| 62 |
; (define-key suntool-map "gr" 'beginning-of-buffer) ; Home, R7 |
| 63 |
|
| 64 |
; (define-key suntool-map "hr" 'previous-line) ; Up, R8 |
| 65 |
; (define-key suntool-map "ir" 'scroll-down) ; PgUp, R9 |
| 66 |
; (define-key suntool-map "iR" 'backward-page) ; Shift-PGUP |
| 67 |
; (define-key suntool-map "jr" 'backward-char) ; Lft, R10 |
| 68 |
(define-key suntool-map "kr" "\C-u\C-l") ; KP5, R11 |
| 69 |
; (define-key suntool-map "lr" 'forward-char) ; Rt, R12 |
| 70 |
; (define-key suntool-map "mr" 'end-of-buffer) ; End, R13 |
| 71 |
; (define-key suntool-map "nr" 'next-line) ; Dn, R14 |
| 72 |
; (define-key suntool-map "or" 'scroll-up) ; PgDn, R15 |
| 73 |
; (define-key suntool-map "oR" 'forward-page) ; Shift-PGUP |
| 74 |
|
| 75 |
(define-key suntool-map "ab" 'apropos) ; Help |
| 76 |
(define-key suntool-map "a\M-b" 'mouse-help) ; M-Help |
| 77 |
(define-key suntool-map "aB" 'describe-bindings) ; HELP |
| 78 |
(define-key suntool-map "a\M-B" 'describe-mouse-bindings); M-HELP |
| 79 |
(define-key suntool-map "a\"" 'command-apropos) ; C-Help |
| 80 |
(define-key suntool-map "a\C-B" 'apropos) ; C-HELP |
| 81 |
(define-key suntool-map "a\M-\C-B" 'help-for-dummies) ; M-C-HELP |
| 82 |
(define-key suntool-map "bb" 'ignore-key) ; Alt |
| 83 |
(define-key suntool-map "cb" 'ignore-key) ; AltGraph |
| 84 |
(define-key suntool-map "db" 'auto-fill-mode) ; Keypad Ins |
| 85 |
(define-key suntool-map "eb" 'overwrite-mode) ; Keypad Del |
| 86 |
(define-key suntool-map "fb" 'call-last-kbd-macro) ; Keypad Enter |
| 87 |
(define-key suntool-map "gb" 'forward-paragraph) ; Keypad + |
| 88 |
(define-key suntool-map "hb" 'backward-paragraph) ; Keypad - |
| 89 |
)) |
| 90 |
|
| 91 |
|
| 92 |
; redefinition of emacs functions |
| 93 |
(defun end-of-buffer () |
| 94 |
"Move point to the end of the buffer; leave a mark at previous position. |
| 95 |
Scroll so that point is at the bottom of the window, if possible." |
| 96 |
(interactive) |
| 97 |
(push-mark) |
| 98 |
(goto-char (point-max)) |
| 99 |
(recenter -1)) |
| 100 |
|
| 101 |
; new functions |
| 102 |
(defun jumpup () |
| 103 |
"Scroll so that point is at the top of the window." |
| 104 |
(interactive)(recenter 0)) |
| 105 |
|
| 106 |
(defun quick-revert-buffer () |
| 107 |
"Revert the buffer without asking for confirmation." |
| 108 |
(interactive) |
| 109 |
(revert-buffer t t)) |
| 110 |
|
| 111 |
(defun quick-revert-other-buffer (n) |
| 112 |
"Revert the Nth other buffer without asking for confirmation." |
| 113 |
(interactive "p") |
| 114 |
(other-window n) |
| 115 |
(revert-buffer t t) |
| 116 |
(other-window (- n))) |
| 117 |
|
| 118 |
(defun bind-last-kbd-macro-to-KP= () |
| 119 |
"Assign the last keyboard macro to the = key on the numeric keypad." |
| 120 |
(interactive) |
| 121 |
(define-key suntool-map "dr" last-kbd-macro)) |
| 122 |
|
| 123 |
(defun bind-last-kbd-macro-to-KP/ () |
| 124 |
"Assign the last keyboard macro to the / key on the numeric keypad." |
| 125 |
(interactive) |
| 126 |
(define-key suntool-map "er" last-kbd-macro)) |
| 127 |
|
| 128 |
(defun bind-last-kbd-macro-to-KP* () |
| 129 |
"Assign the last keyboard macro to the * key on the numeric keypad." |
| 130 |
(interactive) |
| 131 |
(define-key suntool-map "fr" last-kbd-macro)) |
| 132 |
|
| 133 |
(defvar secondlast-kbd-macro nil) |
| 134 |
(defun pre-end-kbd-macro () |
| 135 |
"Preserve last-kbd-macro as secondlast-kbd-macro, then end-kbd-macro." |
| 136 |
(interactive) |
| 137 |
(setq secondlast-kbd-macro last-kbd-macro) |
| 138 |
(end-kbd-macro)) |
| 139 |
(substitute-key-definition 'end-kbd-macro 'pre-end-kbd-macro global-map) |
| 140 |
(substitute-key-definition 'end-kbd-macro 'pre-end-kbd-macro esc-map) |
| 141 |
(substitute-key-definition 'end-kbd-macro 'pre-end-kbd-macro ctl-x-map) |
| 142 |
|
| 143 |
(defun call-secondlast-kbd-macro (n) |
| 144 |
"Like call-last-kbd-macro, but uses the macro defined before that." |
| 145 |
(interactive "p") |
| 146 |
(let ((last-kbd-macro secondlast-kbd-macro)) |
| 147 |
(call-last-kbd-macro n))) |
| 148 |
|
| 149 |
; The turn-numlock-on/off commands are created automatically by oemacs |
| 150 |
; when the NumLock light changes state. |
| 151 |
(defun turn-numlock-on () ; numlock is always off when oemacs starts |
| 152 |
"Bind keys in keypad area to numeric interpretations." |
| 153 |
(interactive) |
| 154 |
(setq hb-binding (lookup-key suntool-map "hb")) |
| 155 |
(setq gb-binding (lookup-key suntool-map "gb")) |
| 156 |
(setq fb-binding (lookup-key suntool-map "fb")) |
| 157 |
(setq eb-binding (lookup-key suntool-map "eb")) |
| 158 |
(setq db-binding (lookup-key suntool-map "db")) |
| 159 |
(define-key suntool-map "hb" "-") |
| 160 |
(define-key suntool-map "gb" "+") |
| 161 |
(define-key suntool-map "fb" "\C-j") |
| 162 |
(define-key suntool-map "eb" ".") |
| 163 |
(define-key suntool-map "db" "0")) |
| 164 |
(defun turn-numlock-off () |
| 165 |
"Rebind keys in keypad area to function-key interpretations." |
| 166 |
(interactive) |
| 167 |
(define-key suntool-map "hb" hb-binding) |
| 168 |
(define-key suntool-map "gb" gb-binding) |
| 169 |
(define-key suntool-map "fb" fb-binding) |
| 170 |
(define-key suntool-map "eb" eb-binding) |
| 171 |
(define-key suntool-map "db" db-binding)) |
| 172 |
(defvar hb-binding nil) |
| 173 |
(defvar gb-binding nil) |
| 174 |
(defvar fb-binding nil) |
| 175 |
(defvar eb-binding nil) |
| 176 |
(defvar db-binding nil) |