diff options
| -rw-r--r-- | lisp/term/wyse50.el | 393 | ||||
| -rw-r--r-- | src/emacs.c | 53 |
2 files changed, 204 insertions, 242 deletions
diff --git a/lisp/term/wyse50.el b/lisp/term/wyse50.el index 712e1062d00..6430a41ce2e 100644 --- a/lisp/term/wyse50.el +++ b/lisp/term/wyse50.el | |||
| @@ -1,235 +1,192 @@ | |||
| 1 | ; Like all the other files in this dir, this one needs to be redone | 1 | ;;;; Terminal mode for Wyse 50 |
| 2 | ; for the new way of handling function keys. | 2 | ;;;; Should work well for Televideo TVI 925 although it's overkill |
| 3 | ;;;; Author Daniel Pfieffer (pfieffer@cix.cict.fr) January 1991 | ||
| 4 | ;;;; Rewritten for Emacs 19 by Jim Blandy (jimb@occs.cs.oberlin.edu) | ||
| 5 | ;;;; January 1992 | ||
| 3 | 6 | ||
| 4 | ; Terminal mode for Wyse 50 | 7 | |
| 5 | ; should work well for Televideo Tvi 925 though it's an overkill | 8 | ;;; Functions especially for this terminal. |
| 6 | ; Author Daniel Pfeiffer <pfeiffer@cix.cict.fr> january 1991 | ||
| 7 | 9 | ||
| 8 | (require 'keypad) | 10 | (defun wyse-50-insert-line () |
| 9 | 11 | "Insert an empty line." | |
| 10 | ; at least some of these should be transferred to keypad.el | 12 | (interactive) |
| 11 | (keypad-default "A" '(lambda () (interactive) | 13 | (beginning-of-line) |
| 12 | ; actually insert an empty line | 14 | (open-line 1)) |
| 13 | (beginning-of-line) | ||
| 14 | (open-line 1))) | ||
| 15 | (keypad-default "E" 'kill-line) | ||
| 16 | ; (keypad-default "h" 'execute-extended-command) | ||
| 17 | (define-key function-keymap "h" 'execute-extended-command) ; bad, bad !! | ||
| 18 | (keypad-default "H" 'shell-command) | ||
| 19 | (keypad-default "I" '(lambda () (interactive) | ||
| 20 | (insert ? ))) ; works even in overwrite-mode | ||
| 21 | (keypad-default "L" '(lambda () (interactive) | ||
| 22 | ; delete the whole line | ||
| 23 | (beginning-of-line) | ||
| 24 | (kill-line 1))) | ||
| 25 | (keypad-default "M" 'overwrite-mode) | ||
| 26 | (keypad-default "\^e" 'shell) ; F5 | ||
| 27 | (keypad-default "\^f" 'dired) ; F6 | ||
| 28 | (keypad-default "\^g" 'rnews) ; F7 | ||
| 29 | (keypad-default "\^h" 'rmail) ; F8 | ||
| 30 | |||
| 31 | (keypad-default "\^i" 'delete-other-windows) ; F9 | ||
| 32 | (keypad-default "\^j" 'other-window) ; F10 | ||
| 33 | (keypad-default "\^k" 'split-window-vertically) ; F11 | ||
| 34 | |||
| 35 | (keypad-default "\^m" 'help-for-help) ; F13 | ||
| 36 | (keypad-default "\^n" 'toggle-screen-width) ; F14 | ||
| 37 | (keypad-default "\^o" 'set-function-key) ; F15 | ||
| 38 | |||
| 39 | |||
| 40 | ; Keys that don't conflict with Emacs defaults | ||
| 41 | ; I write \M-x and \C-x for what the user types, \ex and \^x for key sequences | ||
| 42 | (setup-terminal-keymap global-map | ||
| 43 | '(("\M-?" . ?\?) ; Esc ? | ||
| 44 | ("\eI" . ?T) ; Shift Tab | ||
| 45 | ("\eJ" . ?P) ; Shift Prev PAGE | ||
| 46 | ("\eK" . ?N) ; PAGE Next | ||
| 47 | ("\eY" . ?C) ; Shift Scrn CLR | ||
| 48 | ("\eT" . ?E) ; CLR Line | ||
| 49 | ("\^^" . ?h) ; Home | ||
| 50 | ("\M-\^^" . ?H) ; Esc Home | ||
| 51 | ("\eQ" . ?I) ; INS Char | ||
| 52 | ("\eE" . ?A) ; Shift Line INS | ||
| 53 | ("\eW" . ?D) ; DEL Char | ||
| 54 | ("\eR" . ?L))) ; Shift Line DEL | ||
| 55 | 15 | ||
| 56 | ; Print -- put in some extra security | 16 | (defun wyse-50-delete-line () |
| 57 | (global-set-key "\eP" '(lambda () (interactive) | 17 | "Delete all of the current line." |
| 58 | (if (y-or-n-p | 18 | (interactive) |
| 59 | (concat "Print buffer " | 19 | (beginning-of-line) |
| 60 | (buffer-name) "? ")) | 20 | (kill-line 1)) |
| 61 | (print-buffer)))) | ||
| 62 | 21 | ||
| 22 | (defun wyse-50-insert-char () | ||
| 23 | "Insert a space, even in overwrite mode." | ||
| 24 | (interactive) | ||
| 25 | (insert ? )) | ||
| 63 | 26 | ||
| 64 | ; this is an ugly hack for a nasty problem: | 27 | (defun wyse-50-print-buffer () |
| 65 | ; Wyse 50 takes one character cell to store video attributes (which seems to | 28 | "Like ``print-buffer'', but verifies before printing. |
| 66 | ; explain width 79 rather than 80, column 1 is not used!!!). | 29 | The `print' key is easy to hit on a Wyse 50." |
| 67 | ; On killing (C-x C-c) the end inverse code (on column 1 of line 24) | 30 | (interactive) |
| 68 | ; of the mode line is overwritten AFTER all the y-or-n questions. | 31 | (if (y-or-n-p |
| 69 | ; This causes the attribute to remain in effect until the mode line has | 32 | (concat "Print buffer " |
| 70 | ; scrolled of the screen. Suspending (C-z) does not cause this problem. | 33 | (buffer-name) "? ")) |
| 71 | ; On such terminals, Emacs should sacrifice the first and last character of | 34 | (print-buffer))) |
| 72 | ; each mode line, rather than a whole screen column! | 35 | |
| 73 | (setq kill-emacs-hook '(lambda () (interactive) | 36 | (defun wyse-50-top-of-window (n) |
| 74 | (send-string-to-terminal | 37 | "Move point to the top line of the current window. |
| 75 | (concat "\ea23R" (1+ (screen-width)) "C\eG0")))) | 38 | With an argument N, move to the Nth line of the window." |
| 39 | (interactive "p") | ||
| 40 | (move-to-window-line (1- n))) | ||
| 41 | |||
| 42 | (defun wyse-50-bottom-of-window (n) | ||
| 43 | "Move point to the last line of the current window. | ||
| 44 | With an argument N, move to the Nth line from the bottom of the window." | ||
| 45 | (interactive "p") | ||
| 46 | (move-to-window-line (- n))) | ||
| 47 | |||
| 48 | (defun wyse-50-toggle-screen-width () | ||
| 49 | "Alternate between 80 and 132 columns." | ||
| 50 | (interactive) | ||
| 51 | (if (<= (screen-width) 80) | ||
| 52 | (progn | ||
| 53 | (send-string-to-terminal "\e`;") | ||
| 54 | (set-screen-width 131)) | ||
| 55 | (send-string-to-terminal "\e`:") | ||
| 56 | (set-screen-width 79))) | ||
| 76 | 57 | ||
| 58 | |||
| 59 | ;;; Define the escape sequences for the function keys. | ||
| 60 | (define-key function-key-map "\C-a" (make-keymap)) | ||
| 61 | (mapcar (function (lambda (key-definition) | ||
| 62 | (define-key function-key-map | ||
| 63 | (car key-definition) (nth 1 key-definition)))) | ||
| 64 | '(("\eI" [S-tab]) | ||
| 65 | ("\eJ" [S-prior]) | ||
| 66 | ("\eK" [next]) | ||
| 67 | ("\eY" [clear]) | ||
| 68 | ("\eT" [clear-eol]) | ||
| 69 | ("\^^" [home]) | ||
| 70 | ("\e\^^" [home-down]) | ||
| 71 | ("\eQ" [insert]) | ||
| 72 | ("\eE" [insertline]) | ||
| 73 | ("\eW" [?\C-?]) | ||
| 74 | ("\eR" [deleteline]) | ||
| 75 | ("\eP" [print]) | ||
| 76 | ("\C-k" [up]) | ||
| 77 | ("\C-j" [down]) | ||
| 78 | ("\C-l" [right]) | ||
| 79 | ("\C-h" [left]) | ||
| 80 | ("\C-a\C-k\C-m" [funct-up]) | ||
| 81 | ("\C-a\C-j\C-m" [funct-down]) | ||
| 82 | ("\C-a\C-l\C-m" [funct-right]) | ||
| 83 | ("\C-a\C-h\C-m" [funct-left]) | ||
| 84 | ("\er" [replace]) | ||
| 85 | ("\^a\^m\^m" [funct-return]) | ||
| 86 | ("\^a\^i\^m" [funct-tab]) | ||
| 87 | ("\^a@\^m" [f1]) | ||
| 88 | ("\^a`\^m" [S-f1]) | ||
| 89 | ("\^aA\^m" [f2]) | ||
| 90 | ("\^aa\^m" [S-f2]) | ||
| 91 | ("\^aB\^m" [f3]) | ||
| 92 | ("\^ab\^m" [S-f3]) | ||
| 93 | ("\^aC\^m" [f4]) | ||
| 94 | ("\^ac\^m" [S-f4]) | ||
| 95 | ("\^aD\^m" [f5]) | ||
| 96 | ("\^ad\^m" [S-f5]) | ||
| 97 | ("\^aE\^m" [f6]) | ||
| 98 | ("\^ae\^m" [S-f6]) | ||
| 99 | ("\^aF\^m" [f7]) | ||
| 100 | ("\^af\^m" [S-f7]) | ||
| 101 | ("\^aG\^m" [f8]) | ||
| 102 | ("\^ag\^m" [S-f8]) | ||
| 103 | ("\^aH\^m" [f9]) | ||
| 104 | ("\^ah\^m" [S-f9]) | ||
| 105 | ("\^aI\^m" [f10]) | ||
| 106 | ("\^ai\^m" [S-f10]) | ||
| 107 | ("\^aJ\^m" [f11]) | ||
| 108 | ("\^aj\^m" [S-f11]) | ||
| 109 | ("\^aK\^m" [f12]) | ||
| 110 | ("\^ak\^m" [S-f12]) | ||
| 111 | ("\^aL\^m" [f13]) | ||
| 112 | ("\^al\^m" [S-f13]) | ||
| 113 | ("\^aM\^m" [f14]) | ||
| 114 | ("\^am\^m" [S-f14]) | ||
| 115 | ("\^aN\^m" [f15]) | ||
| 116 | ("\^an\^m" [S-f15]) | ||
| 117 | ("\^aO\^m" [f16]) | ||
| 118 | ("\^ao\^m" [S-f16]))) | ||
| 119 | |||
| 120 | |||
| 121 | ;;; Define some of the function keys. | ||
| 122 | (mapcar (function (lambda (key-definition) | ||
| 123 | (global-set-key (car key-definition) | ||
| 124 | (nth 1 key-definition)))) | ||
| 125 | '(([insertline] wyse-50-insert-line) | ||
| 126 | ([clear] recenter) | ||
| 127 | ([clear-eol] kill-line) | ||
| 128 | ([home] execute-extended-command) | ||
| 129 | ([home-down] shell-command) | ||
| 130 | ([insert] wyse-50-insert-char) | ||
| 131 | ([deleteline] wyse-50-delete-line) | ||
| 132 | ([replace] overwrite-mode) | ||
| 133 | ([print] wyse-50-print-buffer) | ||
| 134 | ([funct-up] wyse-50-top-of-window) | ||
| 135 | ([funct-down] wyse-50-bottom-of-window) | ||
| 136 | ([funct-left] beginning-of-line) | ||
| 137 | ([funct-right] end-of-line) | ||
| 138 | ([f5] shell) | ||
| 139 | ([f6] dired) | ||
| 140 | ([f7] rnews) | ||
| 141 | ([f8] rmail) | ||
| 142 | ([f9] delete-othe-windows) | ||
| 143 | ([f10] other-window) | ||
| 144 | ([f11] split-window-vertically) | ||
| 145 | ([f13] help-for-help) | ||
| 146 | ([f14] wyse-50-toggle-screen-width) | ||
| 147 | ([f15] global-set-key) | ||
| 148 | ("\M-?" help-for-help))) | ||
| 149 | |||
| 150 | |||
| 151 | ;;; Miscellaneous hacks | ||
| 152 | |||
| 153 | ;;; This is an ugly hack for a nasty problem: | ||
| 154 | ;;; Wyse 50 takes one character cell to store video attributes (which seems to | ||
| 155 | ;;; explain width 79 rather than 80, column 1 is not used!!!). | ||
| 156 | ;;; On killing (C-x C-c) the end inverse code (on column 1 of line 24) | ||
| 157 | ;;; of the mode line is overwritten AFTER all the y-or-n questions. | ||
| 158 | ;;; This causes the attribute to remain in effect until the mode line has | ||
| 159 | ;;; scrolled of the screen. Suspending (C-z) does not cause this problem. | ||
| 160 | ;;; On such terminals, Emacs should sacrifice the first and last character of | ||
| 161 | ;;; each mode line, rather than a whole screen column! | ||
| 162 | (setq kill-emacs-hook | ||
| 163 | (function (lambda () (interactive) | ||
| 164 | (send-string-to-terminal | ||
| 165 | (concat "\ea23R" (1+ (screen-width)) "C\eG0"))))) | ||
| 77 | 166 | ||
| 78 | ; This function does more than its name which was copied from term/vt100.el | ||
| 79 | ; Some more neutral name should be used thru-out term/*.el to simplify | ||
| 80 | ; programming term-setup-hook | ||
| 81 | (defun enable-arrow-keys () | 167 | (defun enable-arrow-keys () |
| 82 | "To be called by term-setup-hook. Overrides 6 Emacs standard keys | 168 | "To be called by term-setup-hook. Overrides 6 Emacs standard keys |
| 83 | whose functions are then typed as follows: | 169 | whose functions are then typed as follows: |
| 84 | C-a Funct left-arrow, C-a C-a | 170 | C-a Funct Left-arrow |
| 85 | C-h M-? | 171 | C-h M-? |
| 86 | LFD Funct Return, some modes override down-arrow via LFD | 172 | LFD Funct Return, some modes override down-arrow via LFD |
| 87 | C-k CLR Line | 173 | C-k CLR Line |
| 88 | C-l Shift Scrn CLR | 174 | C-l Scrn CLR |
| 89 | M-r M-x move-to-window-line, Funct up-arrow or down-arrow are similar | 175 | M-r M-x move-to-window-line, Funct up-arrow or down-arrow are similar |
| 90 | All special keys except Send, Shift Ins, Shift Home and shifted functions keys | 176 | All special keys except Send, Shift Ins, Shift Home and shifted functions keys |
| 91 | are assigned some hopefully useful meaning." | 177 | are assigned some hopefully useful meaning." |
| 92 | (interactive) | 178 | (interactive) |
| 93 | 179 | (mapcar (function (lambda (key-definition) | |
| 94 | ; Function keys | 180 | (global-set-key (car key-definition) |
| 95 | (define-key global-map "\^a" (define-prefix-command 'Funct-prefix)) | 181 | (nth 1 key-definition)))) |
| 96 | 182 | ;; By unsetting C-a and then binding it to a prefix, we | |
| 97 | ; Arrow keys | 183 | ;; allow the rest of the function keys which start with C-a |
| 98 | (setup-terminal-keymap global-map | 184 | ;; to be recognized. |
| 99 | '(("\C-a\C-a" . beginning-of-line) ; for auld lang syne | 185 | '(("\C-a" nil) |
| 100 | ("\^a\^m\^m" . newline-and-indent) | 186 | ("\C-a\C-a" beginning-of-line) |
| 101 | 187 | ("\C-k" nil) | |
| 102 | ("\^k" . ?u) ; up-arrow | 188 | ("\C-j" nil) |
| 103 | ("\^j" . ?d) ; down-arrow | 189 | ("\C-l" nil) |
| 104 | ("\^l" . ?r) ; right-arrow | 190 | ("\C-h" nil) |
| 105 | ("\^h" . ?l) ; left-arrow | 191 | ("\er" nil))) |
| 106 | 192 | (fset 'enable-arrow-keys nil)) | |
| 107 | ; Terminal needs both Ins and Repl but Emacs knows how to toggle | ||
| 108 | ; with just one key. No need to override Ins which is "\eq". | ||
| 109 | ("\er" . ?M) ; Repl | ||
| 110 | |||
| 111 | ("\^a\^i\^m" . ?t) ; Funct Tab | ||
| 112 | |||
| 113 | ; Function keys F1 thru F16 (we don't define shifted function keys, | ||
| 114 | ; they send the same code with the middle character in lowercase. | ||
| 115 | ; eg. "Shift F2" is the same as "Funct a" which is more mnemonic but | ||
| 116 | ; keypad.el doesn't provide enough codes to accomodate all these) | ||
| 117 | ("\^a@\^m" . 1) ("\^aH\^m" . 9) | ||
| 118 | ("\^aA\^m" . 2) ("\^aI\^m" . 10) | ||
| 119 | ("\^aB\^m" . 3) ("\^aJ\^m" . 11) | ||
| 120 | ("\^aC\^m" . 4) ("\^aK\^m" . 12) | ||
| 121 | ("\^aD\^m" . 5) ("\^aL\^m" . 13) | ||
| 122 | ("\^aE\^m" . 6) ("\^aM\^m" . 14) | ||
| 123 | ("\^aF\^m" . 7) ("\^aN\^m" . 15) | ||
| 124 | ("\^aG\^m" . 8) ("\^aO\^m" . 16) | ||
| 125 | |||
| 126 | ; Funct Arrow keys | ||
| 127 | ("\^a\^k\^m" . (lambda (n) (interactive "p") | ||
| 128 | (move-to-window-line (1- n)))) | ||
| 129 | ("\^a\^j\^m" . (lambda (n) (interactive "p") | ||
| 130 | (move-to-window-line (- n)))) | ||
| 131 | ("\^a\^h\^m" . beginning-of-line) | ||
| 132 | ("\^a\^l\^m" . end-of-line))) | ||
| 133 | |||
| 134 | ; forget self to put memory to some serious use | ||
| 135 | (fmakunbound 'enable-arrow-keys)) | ||
| 136 | |||
| 137 | |||
| 138 | (defun toggle-screen-width () | ||
| 139 | "Alternate between 80 and 132 columns." | ||
| 140 | (interactive) | ||
| 141 | (if (<= (screen-width) 80) | ||
| 142 | (progn | ||
| 143 | (send-string-to-terminal "\e`;") | ||
| 144 | (set-screen-width 131)) | ||
| 145 | (send-string-to-terminal "\e`:") | ||
| 146 | (set-screen-width 79))) | ||
| 147 | |||
| 148 | ;----------------------------------------------------------------------------- | ||
| 149 | ; this function is completely independent of wyse, it should be auto-loadable | ||
| 150 | ; (presumably from keypad.el) for use in ~/emacs. It should be the only thing | ||
| 151 | ; users need to know about all this unintelligible "forwarding" gibberish. | ||
| 152 | ; This paves the way for a save-function-keys (some day or sleepless night) | ||
| 153 | ; that will edit calls like (set-function-key ?x 'do-whatever) in ~/.emacs. | ||
| 154 | (defun set-function-key (key &optional def) | ||
| 155 | "Prompt for a function or other special key and assign it a meaning. | ||
| 156 | The key must have been \"forwarded\" to a character by term/*.el. | ||
| 157 | |||
| 158 | As a function takes two args CHAR and DEF, with DEF as in define-key. | ||
| 159 | If your terminals term/*.el forwards a physical key to CHAR (before or after | ||
| 160 | calling this function), then that key will mean DEF, else it is ignored. | ||
| 161 | CHAR is one of the following: | ||
| 162 | For numbered function keys | ||
| 163 | 0, 1, ..., 24 (or ?\\^@, ?\\^a, ..., ?\\^x which is the same) | ||
| 164 | For keypad keys in application mode | ||
| 165 | ?0, ?1, ..., ?9 -- keypad key labelled with that digit, | ||
| 166 | but only if that key is not an arrow key (see ?u, ?d, ?r, ?l). | ||
| 167 | ?- -- keypad key labelled `-'. | ||
| 168 | ?. -- keypad key labelled `.'. | ||
| 169 | ?, -- keypad key labelled `,'. | ||
| 170 | ?e -- key labelled enter. | ||
| 171 | For keys labelled with some words or a symbol | ||
| 172 | ?a -- clear all tabs key. | ||
| 173 | ?A -- insert line key. | ||
| 174 | ?C -- clear screen key. | ||
| 175 | ?c -- erase key. | ||
| 176 | ?D -- delete character key. | ||
| 177 | ?d -- down-arrow. | ||
| 178 | ?E -- clear to end of line key. | ||
| 179 | ?e -- key labelled enter. | ||
| 180 | ?f -- find key or search key. | ||
| 181 | ?F -- scroll forward key. | ||
| 182 | ?H -- home-down. | ||
| 183 | ?h -- home-position key. | ||
| 184 | ?I -- insert character key | ||
| 185 | If there is just an \"insert\" key, it should be this. | ||
| 186 | ?k -- delete key or remove key. | ||
| 187 | ?L -- delete line key. | ||
| 188 | ?l -- left-arrow. | ||
| 189 | ?M -- exit insert mode key. | ||
| 190 | ?N -- next page key. | ||
| 191 | ?p -- portrait mode. | ||
| 192 | ?P -- previous page key. | ||
| 193 | ?q -- landscape mode. | ||
| 194 | ?r -- right-arrow. | ||
| 195 | ?R -- scroll reverse key. | ||
| 196 | ?S -- clear to end of screen key. | ||
| 197 | ?s -- select key. | ||
| 198 | ?t -- clear tab this column key. | ||
| 199 | ?T -- set tab this column key. | ||
| 200 | ?u -- up-arrow. | ||
| 201 | ?x -- do key. | ||
| 202 | ?\\? -- help." | ||
| 203 | (interactive "kHit key to redefine") | ||
| 204 | (let ((map function-keymap)) | ||
| 205 | (if (integerp key) | ||
| 206 | () | ||
| 207 | ; reinvent lookup-key to get (map . char) instead of def of char in map | ||
| 208 | (setq map (or (lookup-key global-map | ||
| 209 | (substring key 0 (1- (length key)))) | ||
| 210 | global-map) | ||
| 211 | key (string-to-char (substring key (1- (length key))))) | ||
| 212 | (while (symbolp map) | ||
| 213 | (setq map (symbol-function map))) | ||
| 214 | (setq map (if (listp map) | ||
| 215 | (cdr (assq key (cdr map))) | ||
| 216 | (aref map key))) | ||
| 217 | (if (and (consp map) | ||
| 218 | (integerp (cdr map))) | ||
| 219 | (setq key (cdr map) | ||
| 220 | map (car map)) ; function-keymap usually | ||
| 221 | (error "Key is not a \"forwarded\" definition."))) | ||
| 222 | (if def | ||
| 223 | () | ||
| 224 | (setq def (read-command "command (default last keyboard macro): ")) | ||
| 225 | (if (string-equal (symbol-name def) "") | ||
| 226 | (setq def last-kbd-macro)) | ||
| 227 | (setq command-history ; nonsense really, since you don't see | ||
| 228 | (cons ; key as in a function call (?char) | ||
| 229 | (list 'set-function-key key | ||
| 230 | (if (stringp def) def (list 'quote def))) | ||
| 231 | command-history))) | ||
| 232 | ; all we do when called as a function | ||
| 233 | (define-key map (char-to-string key) def))) | ||
| 234 | |||
| 235 | |||
diff --git a/src/emacs.c b/src/emacs.c index 6e36b42f028..d615e7fdf14 100644 --- a/src/emacs.c +++ b/src/emacs.c | |||
| @@ -39,13 +39,16 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ | |||
| 39 | #include <sys/ioctl.h> | 39 | #include <sys/ioctl.h> |
| 40 | #endif | 40 | #endif |
| 41 | 41 | ||
| 42 | #ifdef HAVE_TERMIOS | ||
| 43 | #include <termios.h> | ||
| 44 | #endif | ||
| 45 | |||
| 42 | #ifdef APOLLO | 46 | #ifdef APOLLO |
| 43 | #ifndef APOLLO_SR10 | 47 | #ifndef APOLLO_SR10 |
| 44 | #include <default_acl.h> | 48 | #include <default_acl.h> |
| 45 | #endif | 49 | #endif |
| 46 | #endif | 50 | #endif |
| 47 | 51 | ||
| 48 | #undef NULL | ||
| 49 | #include "lisp.h" | 52 | #include "lisp.h" |
| 50 | #include "commands.h" | 53 | #include "commands.h" |
| 51 | 54 | ||
| @@ -107,13 +110,10 @@ int fatal_error_code; | |||
| 107 | int fatal_error_in_progress; | 110 | int fatal_error_in_progress; |
| 108 | 111 | ||
| 109 | /* Handle bus errors, illegal instruction, etc. */ | 112 | /* Handle bus errors, illegal instruction, etc. */ |
| 113 | SIGTYPE | ||
| 110 | fatal_error_signal (sig) | 114 | fatal_error_signal (sig) |
| 111 | int sig; | 115 | int sig; |
| 112 | { | 116 | { |
| 113 | #ifdef BSD | ||
| 114 | int tpgrp; | ||
| 115 | #endif /* BSD */ | ||
| 116 | |||
| 117 | fatal_error_code = sig; | 117 | fatal_error_code = sig; |
| 118 | signal (sig, SIG_DFL); | 118 | signal (sig, SIG_DFL); |
| 119 | 119 | ||
| @@ -124,15 +124,23 @@ fatal_error_signal (sig) | |||
| 124 | fatal_error_in_progress = 1; | 124 | fatal_error_in_progress = 1; |
| 125 | 125 | ||
| 126 | /* If we are controlling the terminal, reset terminal modes */ | 126 | /* If we are controlling the terminal, reset terminal modes */ |
| 127 | #ifdef BSD | 127 | #if defined(TIOCGPGRP) || defined(HAVE_TERMIOS) |
| 128 | if (ioctl(0, TIOCGPGRP, &tpgrp) == 0 | 128 | { |
| 129 | && tpgrp == getpgrp (0)) | 129 | int tpgrp; |
| 130 | #endif /* BSD */ | 130 | if ( |
| 131 | { | 131 | #ifdef HAVE_TERMIOS |
| 132 | reset_sys_modes (); | 132 | (tpgrp = tcgetpgrp (0)) != -1 |
| 133 | if (sig != SIGTERM) | 133 | #else |
| 134 | fprintf (stderr, "Fatal error (%d).", sig); | 134 | ioctl(0, TIOCGPGRP, &tpgrp) == 0 |
| 135 | } | 135 | #endif |
| 136 | && tpgrp == getpgrp (0)) | ||
| 137 | { | ||
| 138 | reset_sys_modes (); | ||
| 139 | if (sig != SIGTERM) | ||
| 140 | fprintf (stderr, "Fatal error (%d).", sig); | ||
| 141 | } | ||
| 142 | } | ||
| 143 | #endif /* uses pgrp */ | ||
| 136 | 144 | ||
| 137 | /* Clean up */ | 145 | /* Clean up */ |
| 138 | #ifdef subprocesses | 146 | #ifdef subprocesses |
| @@ -410,9 +418,6 @@ main (argc, argv, envp) | |||
| 410 | } | 418 | } |
| 411 | 419 | ||
| 412 | init_alloc (); | 420 | init_alloc (); |
| 413 | #ifdef MAINTAIN_ENVIRONMENT | ||
| 414 | init_environ (); | ||
| 415 | #endif | ||
| 416 | init_eval (); | 421 | init_eval (); |
| 417 | init_data (); | 422 | init_data (); |
| 418 | init_lread (); | 423 | init_lread (); |
| @@ -454,9 +459,6 @@ main (argc, argv, envp) | |||
| 454 | for the sake of symbols like error-message */ | 459 | for the sake of symbols like error-message */ |
| 455 | syms_of_data (); | 460 | syms_of_data (); |
| 456 | syms_of_alloc (); | 461 | syms_of_alloc (); |
| 457 | #ifdef MAINTAIN_ENVIRONMENT | ||
| 458 | syms_of_environ (); | ||
| 459 | #endif /* MAINTAIN_ENVIRONMENT */ | ||
| 460 | syms_of_lread (); | 462 | syms_of_lread (); |
| 461 | syms_of_print (); | 463 | syms_of_print (); |
| 462 | syms_of_eval (); | 464 | syms_of_eval (); |
| @@ -574,7 +576,7 @@ all of which are called before Emacs is actually killed.") | |||
| 574 | if (feof (stdin)) | 576 | if (feof (stdin)) |
| 575 | arg = Qt; | 577 | arg = Qt; |
| 576 | 578 | ||
| 577 | if (!NULL (Vrun_hooks) && !noninteractive) | 579 | if (!NILP (Vrun_hooks) && !noninteractive) |
| 578 | call1 (Vrun_hooks, intern ("kill-emacs-hook")); | 580 | call1 (Vrun_hooks, intern ("kill-emacs-hook")); |
| 579 | 581 | ||
| 580 | #ifdef subprocesses | 582 | #ifdef subprocesses |
| @@ -677,7 +679,7 @@ and announce itself normally when it is run.") | |||
| 677 | 679 | ||
| 678 | CHECK_STRING (intoname, 0); | 680 | CHECK_STRING (intoname, 0); |
| 679 | intoname = Fexpand_file_name (intoname, Qnil); | 681 | intoname = Fexpand_file_name (intoname, Qnil); |
| 680 | if (!NULL (symname)) | 682 | if (!NILP (symname)) |
| 681 | { | 683 | { |
| 682 | CHECK_STRING (symname, 0); | 684 | CHECK_STRING (symname, 0); |
| 683 | if (XSTRING (symname)->size) | 685 | if (XSTRING (symname)->size) |
| @@ -697,7 +699,7 @@ and announce itself normally when it is run.") | |||
| 697 | malloc_init (&my_edata, malloc_warning); | 699 | malloc_init (&my_edata, malloc_warning); |
| 698 | #endif | 700 | #endif |
| 699 | unexec (XSTRING (intoname)->data, | 701 | unexec (XSTRING (intoname)->data, |
| 700 | !NULL (symname) ? XSTRING (symname)->data : 0, &my_edata, 0, 0); | 702 | !NILP (symname) ? XSTRING (symname)->data : 0, &my_edata, 0, 0); |
| 701 | #endif /* not VMS */ | 703 | #endif /* not VMS */ |
| 702 | 704 | ||
| 703 | Vpurify_flag = tem; | 705 | Vpurify_flag = tem; |
| @@ -724,7 +726,10 @@ decode_env_path (evarname, defalt) | |||
| 724 | 726 | ||
| 725 | Lisp_Object lpath; | 727 | Lisp_Object lpath; |
| 726 | 728 | ||
| 727 | path = (char *) egetenv (evarname); | 729 | /* It's okay to use getenv here, because this function is only used |
| 730 | to initialize variables when Emacs starts up, and isn't called | ||
| 731 | after that. */ | ||
| 732 | path = (char *) getenv (evarname); | ||
| 728 | if (!path) | 733 | if (!path) |
| 729 | path = defalt; | 734 | path = defalt; |
| 730 | lpath = Qnil; | 735 | lpath = Qnil; |