diff options
| author | Karoly Lorentey | 2005-12-25 20:06:58 +0000 |
|---|---|---|
| committer | Karoly Lorentey | 2005-12-25 20:06:58 +0000 |
| commit | ed8dad6b616204b4dd4e853801f41da6f4c3b0a7 (patch) | |
| tree | d260111171143cc889b7c801b911a07cf05da67c /lisp | |
| parent | 4beb2d71ea5cbd7f451b8958c3cd21b3cd4d6edc (diff) | |
| download | emacs-ed8dad6b616204b4dd4e853801f41da6f4c3b0a7.tar.gz emacs-ed8dad6b616204b4dd4e853801f41da6f4c3b0a7.zip | |
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
* lisp/termdev.el (terminal-parameter-alist, terminal-parameters, terminal-parameter-p)
(terminal-parameter, set-terminal-parameter, terminal-handle-delete-frame): Remove.
* src/term.c (Vring_bell_function, device_list, initial_device)
(next_device_id, ring_bell, update_begin, update_end)
(set_terminal_window, cursor_to, raw_cursor_to)
(clear_to_end, clear_frame, clear_end_of_line)
(write_glyphs, insert_glyphs, delete_glyphs, ins_del_lines)
(get_device, Fdisplay_name, create_device, delete_device)
(Fdelete_display, Fdisplay_live_p, Fdisplay_list)
Move to terminal.c.
(syms_of_term): Move their initialization to terminal.c.
* src/terminal.c: New file.
(device_list, next_device_id, initial_device, Vring_bell_function)
(ring_bell, update_begin, update_end, set_terminal_window)
(cursor_to, raw_cursor_to, clear_to_end, clear_frame)
(clear_end_of_line, write_glyphs, insert_glyphs, delete_glyphs)
(ins_del_lines, get_device, create_device, delete_device)
(Fdelete_display, Fdisplay_live_p, Fdisplay_list, Fdisplay_name): Move here.
(mark_devices, get_terminal_param, store_terminal_param)
(Fterminal_parameters, Fterminal_parameter)
(Fmodify_terminal_parameters, Fset_terminal_parameter)
(init_initial_device, delete_initial_device)
(syms_of_terminal): New functions.
* lisp/simple.el (normal-erase-is-backspace-setup-frame)
(normal-erase-is-backspace-mode): Rephrase things
without terminal-parameter-p.
* lisp/termdev.el (terminal-getenv, terminal-setenv)
(with-terminal-environment): Ditto.
* mac/makefile.MPW (EmacsObjects): Add terminal.c.x.
({Src}terminal.c.x): Add dependencies.
* src/Makefile.in (obj): Add terminal.o.
(terminal.o): Add dependencies.
[HAVE_CARBON]: Make terminal.o depend on macgui.h.
* src/alloc.c (mark_devices): Declare.
(Fgarbage_collect): Call `mark_devices'.
* src/dispextern.h (set_scroll_region, turn_off_insert)
(turn_off_highlight, background_highlight, clear_end_of_line_raw)
(tty_clear_end_of_line, tty_setup_colors, delete_tty): Remove.
(raw_cursor_to, clear_to_end, tty_turn_off_insert)
(tty_turn_off_highlight): Add declaration.
* src/emacs.c (main): Call `syms_of_terminal'.
* src/frame.c (get_future_frame_param): New function.
(Fmake_terminal_frame): Use it.
* src/keyboard.c (pop_kboard): Remove unused variable.
(Fset_output_flow_control): Return nil.
* src/keymap.h (Fset_keymap_parent): Add EXFUN.
* src/lisp.h (syms_of_terminal): Declare it.
* src/sysdep.c (reset_sys_modes): Update for renames.
* src/term.c (set_scroll_region): Rename to `tty_set_scroll_region'.
(turn_on_insert): Rename to `tty_turn_on_insert'.
(turn_off_insert): Rename to `tty_turn_off_insert'.
(turn_off_highlight): Rename to `tty_turn_off_highlight'.
(turn_on_highlight): Rename to `tty_turn_on_highlight'.
(toggle_highligh): Rename to `tty_toggle_highlight'.
(background_highlight): Rename to `tty_background_highlight'.
(highlight_if_desired): Rename to `tty_highlight_if_desired'.
(tty_ring_bell, tty_update_end, tty_set_terminal_window)
(tty_set_scroll_region, tty_background_highlight)
(tty_cursor_to, tty_raw_cursor_to, tty_clear_to_end)
(tty_clear_frame, tty_clear_end_of_line, tty_write_glyphs)
(tty_insert_glyphs, tty_delete_glyphs, tty_ins_del_lines)
(term_get_fkeys, tty_setup_colors, dissociate_if_controlling_tty)
(delete_tty): Add static modifier.
(tty_reset_terminal_modes, tty_set_terminal_window)
(tty_set_scroll_region, tty_background_highlight)
(tty_highlight_if_desired, tty_cursor_to)
(tty_raw_cursor_to, tty_clear_to_end, tty_clear_frame)
(tty_clear_end_of_line, tty_write_glyphs, tty_insert_glyphs)
(tty_delete_glyphs, tty_ins_del_lines, turn_on_face):
Update for renames.
* src/termhooks.h (param_alist): New member to struct device.
* src/xterm.h (x_delete_device): Declare.
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-460
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/simple.el | 20 | ||||
| -rw-r--r-- | lisp/termdev.el | 66 |
2 files changed, 13 insertions, 73 deletions
diff --git a/lisp/simple.el b/lisp/simple.el index bfbdaf14d28..99487430c88 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -5323,10 +5323,8 @@ call `normal-erase-is-backspace-mode' (which see) instead." | |||
| 5323 | "Set up `normal-erase-is-backspace-mode' on FRAME, if necessary." | 5323 | "Set up `normal-erase-is-backspace-mode' on FRAME, if necessary." |
| 5324 | (unless frame (setq frame (selected-frame))) | 5324 | (unless frame (setq frame (selected-frame))) |
| 5325 | (with-selected-frame frame | 5325 | (with-selected-frame frame |
| 5326 | (unless (terminal-parameter-p nil 'normal-erase-is-backspace) | 5326 | (unless (terminal-parameter nil 'normal-erase-is-backspace) |
| 5327 | (if (cond ((terminal-parameter-p nil 'normal-erase-is-backspace) | 5327 | (if (cond ((eq normal-erase-is-backspace 'maybe) |
| 5328 | (terminal-parameter nil 'normal-erase-is-backspace)) | ||
| 5329 | ((eq normal-erase-is-backspace 'maybe) | ||
| 5330 | (and (not noninteractive) | 5328 | (and (not noninteractive) |
| 5331 | (or (memq system-type '(ms-dos windows-nt)) | 5329 | (or (memq system-type '(ms-dos windows-nt)) |
| 5332 | (eq window-system 'mac) | 5330 | (eq window-system 'mac) |
| @@ -5376,9 +5374,10 @@ See also `normal-erase-is-backspace'." | |||
| 5376 | (interactive "P") | 5374 | (interactive "P") |
| 5377 | (set-terminal-parameter | 5375 | (set-terminal-parameter |
| 5378 | nil 'normal-erase-is-backspace | 5376 | nil 'normal-erase-is-backspace |
| 5379 | (if arg | 5377 | (if (or (and arg (> (prefix-numeric-value arg) 0)) |
| 5380 | (> (prefix-numeric-value arg) 0) | 5378 | (not (eq 1 (terminal-parameter nil 'normal-erase-is-backspace)))) |
| 5381 | (not (terminal-parameter nil 'normal-erase-is-backspace)))) | 5379 | 0 |
| 5380 | 1)) | ||
| 5382 | 5381 | ||
| 5383 | (cond ((or (memq window-system '(x w32 mac pc)) | 5382 | (cond ((or (memq window-system '(x w32 mac pc)) |
| 5384 | (memq system-type '(ms-dos windows-nt))) | 5383 | (memq system-type '(ms-dos windows-nt))) |
| @@ -5390,7 +5389,7 @@ See also `normal-erase-is-backspace'." | |||
| 5390 | [C-delete] [C-backspace]))) | 5389 | [C-delete] [C-backspace]))) |
| 5391 | (old-state (lookup-key local-function-key-map [delete]))) | 5390 | (old-state (lookup-key local-function-key-map [delete]))) |
| 5392 | 5391 | ||
| 5393 | (if (terminal-parameter nil 'normal-erase-is-backspace) | 5392 | (if (eq 1 (terminal-parameter nil 'normal-erase-is-backspace)) |
| 5394 | (progn | 5393 | (progn |
| 5395 | (define-key local-function-key-map [delete] [?\C-d]) | 5394 | (define-key local-function-key-map [delete] [?\C-d]) |
| 5396 | (define-key local-function-key-map [kp-delete] [?\C-d]) | 5395 | (define-key local-function-key-map [kp-delete] [?\C-d]) |
| @@ -5412,7 +5411,7 @@ See also `normal-erase-is-backspace'." | |||
| 5412 | (define-key map key1 binding2) | 5411 | (define-key map key1 binding2) |
| 5413 | (define-key map key2 binding1))))))) | 5412 | (define-key map key2 binding1))))))) |
| 5414 | (t | 5413 | (t |
| 5415 | (if (terminal-parameter nil 'normal-erase-is-backspace) | 5414 | (if (eq 1 (terminal-parameter nil 'normal-erase-is-backspace)) |
| 5416 | (progn | 5415 | (progn |
| 5417 | (keyboard-translate ?\C-h ?\C-?) | 5416 | (keyboard-translate ?\C-h ?\C-?) |
| 5418 | (keyboard-translate ?\C-? ?\C-d)) | 5417 | (keyboard-translate ?\C-? ?\C-d)) |
| @@ -5422,7 +5421,8 @@ See also `normal-erase-is-backspace'." | |||
| 5422 | (run-hooks 'normal-erase-is-backspace-hook) | 5421 | (run-hooks 'normal-erase-is-backspace-hook) |
| 5423 | (if (interactive-p) | 5422 | (if (interactive-p) |
| 5424 | (message "Delete key deletes %s" | 5423 | (message "Delete key deletes %s" |
| 5425 | (if normal-erase-is-backspace "forward" "backward")))) | 5424 | (if (terminal-parameter nil 'normal-erase-is-backspace) |
| 5425 | "forward" "backward")))) | ||
| 5426 | 5426 | ||
| 5427 | (defvar vis-mode-saved-buffer-invisibility-spec nil | 5427 | (defvar vis-mode-saved-buffer-invisibility-spec nil |
| 5428 | "Saved value of `buffer-invisibility-spec' when Visible mode is on.") | 5428 | "Saved value of `buffer-invisibility-spec' when Visible mode is on.") |
diff --git a/lisp/termdev.el b/lisp/termdev.el index 667975b9b8b..f413067d542 100644 --- a/lisp/termdev.el +++ b/lisp/termdev.el | |||
| @@ -48,66 +48,6 @@ device (HOST.SERVER.SCREEN) or a tty device file." | |||
| 48 | (t | 48 | (t |
| 49 | (error "Invalid argument %s in `terminal-id'" terminal)))) | 49 | (error "Invalid argument %s in `terminal-id'" terminal)))) |
| 50 | 50 | ||
| 51 | (defvar terminal-parameter-alist nil | ||
| 52 | "An alist of terminal parameter alists.") | ||
| 53 | |||
| 54 | (defun terminal-parameters (&optional terminal) | ||
| 55 | "Return the paramater-alist of terminal TERMINAL. | ||
| 56 | It is a list of elements of the form (PARM . VALUE), where PARM is a symbol. | ||
| 57 | |||
| 58 | TERMINAL can be a terminal id, a frame, or nil (meaning the | ||
| 59 | selected frame's terminal)." | ||
| 60 | (cdr (assq (terminal-id terminal) terminal-parameter-alist))) | ||
| 61 | |||
| 62 | (defun terminal-parameter-p (terminal parameter) | ||
| 63 | "Return non-nil if PARAMETER is a terminal parameter on TERMINAL. | ||
| 64 | |||
| 65 | The actual value returned in that case is a cell (PARAMETER . VALUE), | ||
| 66 | where VALUE is the current value of PARAMETER. | ||
| 67 | |||
| 68 | TERMINAL can be a terminal id, a frame, or nil (meaning the | ||
| 69 | selected frame's terminal)." | ||
| 70 | (assq parameter (cdr (assq (terminal-id terminal) terminal-parameter-alist)))) | ||
| 71 | |||
| 72 | (defun terminal-parameter (terminal parameter) | ||
| 73 | "Return TERMINAL's value for parameter PARAMETER. | ||
| 74 | |||
| 75 | TERMINAL can be a terminal id, a frame, or nil (meaning the | ||
| 76 | selected frame's terminal)." | ||
| 77 | (cdr (terminal-parameter-p terminal parameter))) | ||
| 78 | |||
| 79 | (defun set-terminal-parameter (terminal parameter value) | ||
| 80 | "Set TERMINAL's value for parameter PARAMETER to VALUE. | ||
| 81 | Returns the previous value of PARAMETER. | ||
| 82 | |||
| 83 | TERMINAL can be a terminal id, a frame, or nil (meaning the | ||
| 84 | selected frame's terminal)." | ||
| 85 | (setq terminal (terminal-id terminal)) | ||
| 86 | (let* ((alist (assq terminal terminal-parameter-alist)) | ||
| 87 | (pair (assq parameter (cdr alist))) | ||
| 88 | (result (cdr pair))) | ||
| 89 | (cond | ||
| 90 | (pair (setcdr pair value)) | ||
| 91 | (alist (setcdr alist (cons (cons parameter value) (cdr alist)))) | ||
| 92 | (t (setq terminal-parameter-alist | ||
| 93 | (cons (cons terminal | ||
| 94 | (cons (cons parameter value) | ||
| 95 | nil)) | ||
| 96 | terminal-parameter-alist)))) | ||
| 97 | result)) | ||
| 98 | |||
| 99 | (defun terminal-handle-delete-frame (frame) | ||
| 100 | "Clean up terminal parameters of FRAME, if it's the last frame on its terminal." | ||
| 101 | ;; XXX We assume that the display is closed immediately after the | ||
| 102 | ;; last frame is deleted on it. It would be better to create a hook | ||
| 103 | ;; called `delete-display-functions', and use it instead. | ||
| 104 | (when (and (frame-live-p frame) | ||
| 105 | (= 1 (length (frames-on-display-list (frame-display frame))))) | ||
| 106 | (setq terminal-parameter-alist | ||
| 107 | (assq-delete-all (frame-display frame) terminal-parameter-alist)))) | ||
| 108 | |||
| 109 | (add-hook 'delete-frame-functions 'terminal-handle-delete-frame) | ||
| 110 | |||
| 111 | (defun terminal-getenv (variable &optional terminal global-ok) | 51 | (defun terminal-getenv (variable &optional terminal global-ok) |
| 112 | "Get the value of VARIABLE in the client environment of TERMINAL. | 52 | "Get the value of VARIABLE in the client environment of TERMINAL. |
| 113 | VARIABLE should be a string. Value is nil if VARIABLE is undefined in | 53 | VARIABLE should be a string. Value is nil if VARIABLE is undefined in |
| @@ -125,7 +65,7 @@ its value in the global environment instead. | |||
| 125 | TERMINAL can be a terminal id, a frame, or nil (meaning the | 65 | TERMINAL can be a terminal id, a frame, or nil (meaning the |
| 126 | selected frame's terminal)." | 66 | selected frame's terminal)." |
| 127 | (setq terminal (terminal-id terminal)) | 67 | (setq terminal (terminal-id terminal)) |
| 128 | (if (not (terminal-parameter-p terminal 'environment)) | 68 | (if (null (terminal-parameter terminal 'environment)) |
| 129 | (getenv variable) | 69 | (getenv variable) |
| 130 | (if (multibyte-string-p variable) | 70 | (if (multibyte-string-p variable) |
| 131 | (setq variable (encode-coding-string variable locale-coding-system))) | 71 | (setq variable (encode-coding-string variable locale-coding-system))) |
| @@ -156,7 +96,7 @@ process itself. | |||
| 156 | 96 | ||
| 157 | TERMINAL can be a terminal id, a frame, or nil (meaning the | 97 | TERMINAL can be a terminal id, a frame, or nil (meaning the |
| 158 | selected frame's terminal)." | 98 | selected frame's terminal)." |
| 159 | (if (not (terminal-parameter-p terminal 'environment)) | 99 | (if (null (terminal-parameter terminal 'environment)) |
| 160 | (setenv variable value) | 100 | (setenv variable value) |
| 161 | (with-terminal-environment terminal variable | 101 | (with-terminal-environment terminal variable |
| 162 | (setenv variable value)))) | 102 | (setenv variable value)))) |
| @@ -222,7 +162,7 @@ then the new variable values will be remembered for TERMINAL, and | |||
| 222 | (if (stringp ,v) | 162 | (if (stringp ,v) |
| 223 | (setq ,v (list ,v))) | 163 | (setq ,v (list ,v))) |
| 224 | (cond | 164 | (cond |
| 225 | ((not (terminal-parameter-p ,term 'environment)) | 165 | ((null (terminal-parameter ,term 'environment)) |
| 226 | ;; Not a remote terminal; nothing to do. | 166 | ;; Not a remote terminal; nothing to do. |
| 227 | (progn ,@body)) | 167 | (progn ,@body)) |
| 228 | ((eq ,v t) | 168 | ((eq ,v t) |