aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/termdev.el
diff options
context:
space:
mode:
authorKaroly Lorentey2005-12-25 20:06:58 +0000
committerKaroly Lorentey2005-12-25 20:06:58 +0000
commited8dad6b616204b4dd4e853801f41da6f4c3b0a7 (patch)
treed260111171143cc889b7c801b911a07cf05da67c /lisp/termdev.el
parent4beb2d71ea5cbd7f451b8958c3cd21b3cd4d6edc (diff)
downloademacs-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/termdev.el')
-rw-r--r--lisp/termdev.el66
1 files changed, 3 insertions, 63 deletions
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.
56It is a list of elements of the form (PARM . VALUE), where PARM is a symbol.
57
58TERMINAL can be a terminal id, a frame, or nil (meaning the
59selected 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
65The actual value returned in that case is a cell (PARAMETER . VALUE),
66where VALUE is the current value of PARAMETER.
67
68TERMINAL can be a terminal id, a frame, or nil (meaning the
69selected 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
75TERMINAL can be a terminal id, a frame, or nil (meaning the
76selected 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.
81Returns the previous value of PARAMETER.
82
83TERMINAL can be a terminal id, a frame, or nil (meaning the
84selected 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.
113VARIABLE should be a string. Value is nil if VARIABLE is undefined in 53VARIABLE should be a string. Value is nil if VARIABLE is undefined in
@@ -125,7 +65,7 @@ its value in the global environment instead.
125TERMINAL can be a terminal id, a frame, or nil (meaning the 65TERMINAL can be a terminal id, a frame, or nil (meaning the
126selected frame's terminal)." 66selected 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
157TERMINAL can be a terminal id, a frame, or nil (meaning the 97TERMINAL can be a terminal id, a frame, or nil (meaning the
158selected frame's terminal)." 98selected 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)