Commit ed8dad6b authored by Karoly Lorentey's avatar Karoly Lorentey

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
parent 4beb2d71
......@@ -401,6 +401,41 @@ is probably not very interesting for anyone else.)
THINGS TO DO
------------
** Implement automatic forwarding of client environment variables to
forked processes, as discussed on the multi-tty list. Terminal
parameters are now accessible in C code, so the biggest obstacle is
gone. The `getenv_internal' and `child_setup' functions in
callproc.c must be changed to support the following variable:
terminal-local-environment-variables is a variable defined in ...
Enable or disable terminal-local environment variables.
If set to t, `getenv', `setenv' and subprocess creation
functions use the environment variables of the emacsclient
process that created the selected frame, ignoring
`process-environment'.
If set to nil, Emacs uses `process-environment' and ignores
the client environment.
Otherwise, `terminal-local-environment-variables' should be a
list of variable names (represented by Lisp strings) to look
up in the client environment. The rest will come from
`process-environment'.
** (Possibly) create hooks in struct device for creating frames on a
specific terminal, and eliminate the hackish terminal-related frame
parameters (display, tty, tty-type).
make_terminal_frame
create_tty_output
** Move Fsend_string_to_terminal to term.c, and declare get_named_tty
as static, removing it from dispextern.h.
Move fatal to emacs.c and declare it somewhere.
** Search for `suspend-emacs' references and replace them with
`suspend-frame', if necessary. Ditto for `save-buffers-kill-emacs'
vs. `save-buffers-kill-display'.
......@@ -450,6 +485,11 @@ THINGS TO DO
** I think `(set-)terminal-local-value' and the terminal parameter
mechanism should be integrated into a single framework.
(Update: `(set-)terminal-local-value' is now eliminated, but the
terminal-local variables should still be accessible as terminal
parameters. This also applies to `display-name' and similar
functions.)
** Add the following hooks: after-delete-frame-hook (for server.el,
instead of delete-frame-functions),
after-delete-terminal-functions, after-create-terminal-functions.
......
......@@ -5323,10 +5323,8 @@ call `normal-erase-is-backspace-mode' (which see) instead."
"Set up `normal-erase-is-backspace-mode' on FRAME, if necessary."
(unless frame (setq frame (selected-frame)))
(with-selected-frame frame
(unless (terminal-parameter-p nil 'normal-erase-is-backspace)
(if (cond ((terminal-parameter-p nil 'normal-erase-is-backspace)
(terminal-parameter nil 'normal-erase-is-backspace))
((eq normal-erase-is-backspace 'maybe)
(unless (terminal-parameter nil 'normal-erase-is-backspace)
(if (cond ((eq normal-erase-is-backspace 'maybe)
(and (not noninteractive)
(or (memq system-type '(ms-dos windows-nt))
(eq window-system 'mac)
......@@ -5376,9 +5374,10 @@ See also `normal-erase-is-backspace'."
(interactive "P")
(set-terminal-parameter
nil 'normal-erase-is-backspace
(if arg
(> (prefix-numeric-value arg) 0)
(not (terminal-parameter nil 'normal-erase-is-backspace))))
(if (or (and arg (> (prefix-numeric-value arg) 0))
(not (eq 1 (terminal-parameter nil 'normal-erase-is-backspace))))
0
1))
(cond ((or (memq window-system '(x w32 mac pc))
(memq system-type '(ms-dos windows-nt)))
......@@ -5390,7 +5389,7 @@ See also `normal-erase-is-backspace'."
[C-delete] [C-backspace])))
(old-state (lookup-key local-function-key-map [delete])))
(if (terminal-parameter nil 'normal-erase-is-backspace)
(if (eq 1 (terminal-parameter nil 'normal-erase-is-backspace))
(progn
(define-key local-function-key-map [delete] [?\C-d])
(define-key local-function-key-map [kp-delete] [?\C-d])
......@@ -5412,7 +5411,7 @@ See also `normal-erase-is-backspace'."
(define-key map key1 binding2)
(define-key map key2 binding1)))))))
(t
(if (terminal-parameter nil 'normal-erase-is-backspace)
(if (eq 1 (terminal-parameter nil 'normal-erase-is-backspace))
(progn
(keyboard-translate ?\C-h ?\C-?)
(keyboard-translate ?\C-? ?\C-d))
......@@ -5422,7 +5421,8 @@ See also `normal-erase-is-backspace'."
(run-hooks 'normal-erase-is-backspace-hook)
(if (interactive-p)
(message "Delete key deletes %s"
(if normal-erase-is-backspace "forward" "backward"))))
(if (terminal-parameter nil 'normal-erase-is-backspace)
"forward" "backward"))))
(defvar vis-mode-saved-buffer-invisibility-spec nil
"Saved value of `buffer-invisibility-spec' when Visible mode is on.")
......
......@@ -48,66 +48,6 @@ device (HOST.SERVER.SCREEN) or a tty device file."
(t
(error "Invalid argument %s in `terminal-id'" terminal))))
(defvar terminal-parameter-alist nil
"An alist of terminal parameter alists.")
(defun terminal-parameters (&optional terminal)
"Return the paramater-alist of terminal TERMINAL.
It is a list of elements of the form (PARM . VALUE), where PARM is a symbol.
TERMINAL can be a terminal id, a frame, or nil (meaning the
selected frame's terminal)."
(cdr (assq (terminal-id terminal) terminal-parameter-alist)))
(defun terminal-parameter-p (terminal parameter)
"Return non-nil if PARAMETER is a terminal parameter on TERMINAL.
The actual value returned in that case is a cell (PARAMETER . VALUE),
where VALUE is the current value of PARAMETER.
TERMINAL can be a terminal id, a frame, or nil (meaning the
selected frame's terminal)."
(assq parameter (cdr (assq (terminal-id terminal) terminal-parameter-alist))))
(defun terminal-parameter (terminal parameter)
"Return TERMINAL's value for parameter PARAMETER.
TERMINAL can be a terminal id, a frame, or nil (meaning the
selected frame's terminal)."
(cdr (terminal-parameter-p terminal parameter)))
(defun set-terminal-parameter (terminal parameter value)
"Set TERMINAL's value for parameter PARAMETER to VALUE.
Returns the previous value of PARAMETER.
TERMINAL can be a terminal id, a frame, or nil (meaning the
selected frame's terminal)."
(setq terminal (terminal-id terminal))
(let* ((alist (assq terminal terminal-parameter-alist))
(pair (assq parameter (cdr alist)))
(result (cdr pair)))
(cond
(pair (setcdr pair value))
(alist (setcdr alist (cons (cons parameter value) (cdr alist))))
(t (setq terminal-parameter-alist
(cons (cons terminal
(cons (cons parameter value)
nil))
terminal-parameter-alist))))
result))
(defun terminal-handle-delete-frame (frame)
"Clean up terminal parameters of FRAME, if it's the last frame on its terminal."
;; XXX We assume that the display is closed immediately after the
;; last frame is deleted on it. It would be better to create a hook
;; called `delete-display-functions', and use it instead.
(when (and (frame-live-p frame)
(= 1 (length (frames-on-display-list (frame-display frame)))))
(setq terminal-parameter-alist
(assq-delete-all (frame-display frame) terminal-parameter-alist))))
(add-hook 'delete-frame-functions 'terminal-handle-delete-frame)
(defun terminal-getenv (variable &optional terminal global-ok)
"Get the value of VARIABLE in the client environment of TERMINAL.
VARIABLE should be a string. Value is nil if VARIABLE is undefined in
......@@ -125,7 +65,7 @@ its value in the global environment instead.
TERMINAL can be a terminal id, a frame, or nil (meaning the
selected frame's terminal)."
(setq terminal (terminal-id terminal))
(if (not (terminal-parameter-p terminal 'environment))
(if (null (terminal-parameter terminal 'environment))
(getenv variable)
(if (multibyte-string-p variable)
(setq variable (encode-coding-string variable locale-coding-system)))
......@@ -156,7 +96,7 @@ process itself.
TERMINAL can be a terminal id, a frame, or nil (meaning the
selected frame's terminal)."
(if (not (terminal-parameter-p terminal 'environment))
(if (null (terminal-parameter terminal 'environment))
(setenv variable value)
(with-terminal-environment terminal variable
(setenv variable value))))
......@@ -222,7 +162,7 @@ then the new variable values will be remembered for TERMINAL, and
(if (stringp ,v)
(setq ,v (list ,v)))
(cond
((not (terminal-parameter-p ,term 'environment))
((null (terminal-parameter ,term 'environment))
;; Not a remote terminal; nothing to do.
(progn ,@body))
((eq ,v t)
......
......@@ -118,6 +118,7 @@ EmacsObjects =
"{Src}sysdep.c.x"
"{Src}term.c.x"
"{Src}termcap.c.x"
"{Src}terminal.c.x"
"{Src}textprop.c.x"
"{Src}tparam.c.x"
"{Src}undo.c.x"
......@@ -792,6 +793,16 @@ buildobj.lst
"{Src}lisp.h"
"{Includes}sys:file.h"
{Src}terminal.c.x
{CONFIG_H_GROUP}
"{Src}lisp.h"
"{Src}frame.h"
"{Src}termchar.h"
"{Src}termhooks.h"
"{Src}charset.h"
"{Src}coding.h"
"{Src}keyboard.h"
{Src}textproc.c.x
{CONFIG_H_GROUP}
"{Src}lisp.h"
......
......@@ -577,7 +577,7 @@ emacsappsrc = ${srcdir}/../mac/Emacs.app/
whose initialized data areas should be dumped as pure by dump-emacs. */
obj= dispnew.o frame.o scroll.o xdisp.o $(XMENU_OBJ) window.o \
charset.o coding.o category.o ccl.o \
cm.o term.o xfaces.o $(XOBJ) $(GTK_OBJ)\
cm.o term.o terminal.o xfaces.o $(XOBJ) $(GTK_OBJ)\
emacs.o keyboard.o macros.o keymap.o sysdep.o \
buffer.o filelock.o insdel.o marker.o \
minibuf.o fileio.o dired.o filemode.o \
......@@ -1171,6 +1171,8 @@ term.o: term.c termchar.h termhooks.h termopts.h $(config_h) cm.h frame.h \
disptab.h dispextern.h keyboard.h charset.h coding.h ccl.h msdos.h \
window.h keymap.h
termcap.o: termcap.c $(config_h)
terminal.o: terminal.c frame.h termchar.h termhooks.h charset.h coding.h \
keyboard.h $(config_h)
terminfo.o: terminfo.c $(config_h)
tparam.o: tparam.c $(config_h)
undo.o: undo.c buffer.h commands.h $(config_h)
......@@ -1250,7 +1252,7 @@ sunfns.o: sunfns.c buffer.h window.h dispextern.h termhooks.h $(config_h)
#ifdef HAVE_CARBON
abbrev.o buffer.o callint.o cmds.o dispnew.o editfns.o fileio.o frame.o \
fontset.o indent.o insdel.o keyboard.o macros.o minibuf.o msdos.o process.o \
scroll.o sysdep.o term.o widget.o window.o xdisp.o xfaces.o xfns.o xmenu.o \
scroll.o sysdep.o term.o terminal.o widget.o window.o xdisp.o xfaces.o xfns.o xmenu.o \
xterm.o xselect.o sound.o: macgui.h
mac.o: mac.c process.h sysselect.h blockinput.h atimer.h systime.h charset.h \
coding.h ccl.h $(config_h)
......
......@@ -324,6 +324,7 @@ Lisp_Object Vgc_elapsed; /* accumulated elapsed time in GC */
EMACS_INT gcs_done; /* accumulated GCs */
static void mark_buffer P_ ((Lisp_Object));
extern void mark_devices P_ ((void));
extern void mark_kboards P_ ((void));
extern void mark_ttys P_ ((void));
extern void mark_backtrace P_ ((void));
......@@ -4937,6 +4938,7 @@ returns nil, because real GC can't be done. */)
mark_object (bind->symbol);
mark_object (bind->old_value);
}
mark_devices ();
mark_kboards ();
mark_ttys ();
......
......@@ -2622,8 +2622,6 @@ void init_iterator_to_row_start P_ ((struct it *, struct window *,
struct glyph_row *));
int get_next_display_element P_ ((struct it *));
void set_iterator_to_next P_ ((struct it *, int));
void produce_glyphs P_ ((struct it *));
void produce_special_glyphs P_ ((struct it *, enum display_element_type));
void start_display P_ ((struct it *, struct window *, struct text_pos));
void move_it_to P_ ((struct it *, int, int, int, int, int));
void move_it_vertically P_ ((struct it *, int));
......@@ -2905,8 +2903,6 @@ void clear_glyph_row P_ ((struct glyph_row *));
void prepare_desired_row P_ ((struct glyph_row *));
int line_hash_code P_ ((struct glyph_row *));
void set_window_update_flags P_ ((struct window *, int));
void write_glyphs P_ ((struct frame *, struct glyph *, int));
void insert_glyphs P_ ((struct frame *, struct glyph *, int));
void redraw_frame P_ ((struct frame *));
void redraw_garbaged_frames P_ ((void));
int scroll_cost P_ ((struct frame *, int, int, int));
......@@ -2924,39 +2920,48 @@ void syms_of_display P_ ((void));
extern Lisp_Object Qredisplay_dont_pause;
GLYPH spec_glyph_lookup_face P_ ((struct window *, GLYPH));
/* Defined in term.c */
/* Defined in terminal.c */
extern void ring_bell P_ ((struct frame *));
extern void update_begin P_ ((struct frame *));
extern void update_end P_ ((struct frame *));
extern void set_terminal_window P_ ((struct frame *, int));
extern void set_scroll_region P_ ((struct frame *, int, int));
extern void turn_off_insert P_ ((struct tty_display_info *));
extern void turn_off_highlight P_ ((struct tty_display_info *));
extern void background_highlight P_ ((struct tty_display_info *));
extern void cursor_to P_ ((struct frame *, int, int));
/* Was not declared before: */
extern void raw_cursor_to P_ ((struct frame *, int, int));
extern void clear_to_end P_ ((struct frame *));
extern void clear_frame P_ ((struct frame *));
extern void clear_end_of_line P_ ((struct frame *, int));
extern void clear_end_of_line_raw P_ ((struct frame *, int));
extern void tty_clear_end_of_line P_ ((struct frame *, int));
extern void write_glyphs P_ ((struct frame *, struct glyph *, int));
extern void insert_glyphs P_ ((struct frame *, struct glyph *, int));
extern void delete_glyphs P_ ((struct frame *, int));
extern void ins_del_lines P_ ((struct frame *, int, int));
extern struct device *get_device P_ ((Lisp_Object display, int));
extern struct device *init_initial_device P_ ((void));
/* Defined in term.c */
extern void tty_set_terminal_modes P_ ((struct device *));
extern void tty_reset_terminal_modes P_ ((struct device *));
extern void tty_turn_off_insert P_ ((struct tty_display_info *));
extern void tty_turn_off_highlight P_ ((struct tty_display_info *));
extern int string_cost P_ ((char *));
extern int per_line_cost P_ ((char *));
extern void calculate_costs P_ ((struct frame *));
extern void produce_glyphs P_ ((struct it *));
extern void produce_special_glyphs P_ ((struct it *, enum display_element_type));
extern int tty_capable_p P_ ((struct tty_display_info *, unsigned, unsigned long, unsigned long));
extern void set_tty_color_mode P_ ((struct frame *, Lisp_Object));
extern void tty_setup_colors P_ ((struct tty_display_info *, int));
extern struct device *get_device P_ ((Lisp_Object display, int));
extern struct device *get_tty_device P_ ((Lisp_Object terminal));
extern struct device *get_named_tty P_ ((char *));
EXFUN (Fdisplay_tty_type, 1);
extern struct device *init_initial_device P_ ((void));
extern struct device *init_tty P_ ((char *, char *, int));
extern void delete_tty P_ ((struct device *));
extern void cursor_to P_ ((struct frame *, int, int));
extern int tty_capable_p P_ ((struct tty_display_info *, unsigned, unsigned long, unsigned long));
extern void tty_set_terminal_modes P_ ((struct device *));
extern void tty_reset_terminal_modes P_ ((struct device *));
extern void create_tty_output P_ ((struct frame *));
extern struct device *init_tty P_ ((char *, char *, int));
/* Defined in scroll.c */
......
......@@ -1600,6 +1600,7 @@ main (argc, argv
syms_of_frame ();
#endif
syms_of_syntax ();
syms_of_terminal ();
syms_of_term ();
syms_of_undo ();
#ifdef HAVE_SOUND
......
......@@ -638,6 +638,33 @@ make_terminal_frame (struct device *device)
return f;
}
/* Get a suitable value for frame parameter PARAMETER for a newly
created frame, based on (1) the user-supplied frame parameter
alist SUPPLIED_PARMS, (2) CURRENT_VALUE, and finally, if all else
fails, (3) Vdefault_frame_alist. */
static Lisp_Object
get_future_frame_param (Lisp_Object parameter,
Lisp_Object supplied_parms,
char *current_value)
{
Lisp_Object result;
result = Fassq (parameter, supplied_parms);
if (NILP (result))
result = Fassq (parameter, XFRAME (selected_frame)->param_alist);
if (NILP (result) && current_value != NULL)
result = build_string (current_value);
if (NILP (result))
result = Fassq (parameter, Vdefault_frame_alist);
if (!NILP (result) && !STRINGP (result))
result = XCDR (result);
if (NILP (result) || !STRINGP (result))
result = Qnil;
return result;
}
DEFUN ("make-terminal-frame", Fmake_terminal_frame, Smake_terminal_frame,
1, 1, 0,
doc: /* Create an additional terminal frame, possibly on another terminal.
......@@ -662,8 +689,6 @@ affects all frames on the same terminal device. */)
struct device *d = NULL;
Lisp_Object frame, tem;
struct frame *sf = SELECTED_FRAME ();
Lisp_Object tty, tty_type;
struct gcpro gcpro1, gcpro2;
#ifdef MSDOS
if (sf->output_method != output_msdos_raw
......@@ -697,41 +722,24 @@ affects all frames on the same terminal device. */)
if (!d)
{
char *name = 0, *type = 0;
Lisp_Object tty, tty_type;
tty = Fassq (Qtty, parms);
if (EQ (tty, Qnil))
tty = Fassq (Qtty, XFRAME (selected_frame)->param_alist);
if (EQ (tty, Qnil) && FRAME_TERMCAP_P (XFRAME (selected_frame))
&& FRAME_TTY (XFRAME (selected_frame))->name)
tty = build_string (FRAME_TTY (XFRAME (selected_frame))->name);
if (EQ (tty, Qnil))
tty = Fassq (Qtty, Vdefault_frame_alist);
if (! EQ (tty, Qnil) && ! STRINGP (tty))
tty = XCDR (tty);
if (EQ (tty, Qnil) || !STRINGP (tty))
tty = Qnil;
tty_type = Fassq (Qtty_type, parms);
if (EQ (tty_type, Qnil))
tty_type = Fassq (Qtty_type, XFRAME (selected_frame)->param_alist);
if (EQ (tty_type, Qnil) && FRAME_TERMCAP_P (XFRAME (selected_frame))
&& FRAME_TTY (XFRAME (selected_frame))->type)
tty_type = build_string (FRAME_TTY (XFRAME (selected_frame))->type);
if (EQ (tty_type, Qnil))
tty_type = Fassq (Qtty_type, Vdefault_frame_alist);
if (! EQ (tty_type, Qnil) && ! STRINGP (tty_type))
tty_type = XCDR (tty_type);
if (EQ (tty_type, Qnil) || !STRINGP (tty_type))
tty_type = Qnil;
if (! EQ (tty, Qnil))
tty = get_future_frame_param
(Qtty, parms, (FRAME_TERMCAP_P (XFRAME (selected_frame))
? FRAME_TTY (XFRAME (selected_frame))->name
: NULL));
if (!NILP (tty))
{
name = (char *) alloca (SBYTES (tty) + 1);
strncpy (name, SDATA (tty), SBYTES (tty));
name[SBYTES (tty)] = 0;
}
if (! EQ (tty_type, Qnil))
tty_type = get_future_frame_param
(Qtty_type, parms, (FRAME_TERMCAP_P (XFRAME (selected_frame))
? FRAME_TTY (XFRAME (selected_frame))->type
: NULL));
if (!NILP (tty_type))
{
type = (char *) alloca (SBYTES (tty_type) + 1);
strncpy (type, SDATA (tty_type), SBYTES (tty_type));
......@@ -752,13 +760,15 @@ affects all frames on the same terminal device. */)
adjust_glyphs (f);
calculate_costs (f);
XSETFRAME (frame, f);
GCPRO2 (tty_type, tty);
Fmodify_frame_parameters (frame, Vdefault_frame_alist);
Fmodify_frame_parameters (frame, parms);
Fmodify_frame_parameters (frame, Fcons (Fcons (Qwindow_system, Qnil), Qnil));
Fmodify_frame_parameters (frame, Fcons (Fcons (Qtty_type, tty_type), Qnil));
Fmodify_frame_parameters (frame, Fcons (Fcons (Qtty, tty), Qnil));
UNGCPRO;
Fmodify_frame_parameters (frame, Fcons (Fcons (Qtty_type,
build_string (d->display_info.tty->type)),
Qnil));
Fmodify_frame_parameters (frame, Fcons (Fcons (Qtty,
build_string (d->display_info.tty->name)),
Qnil));
/* Make the frame face alist be frame-specific, so that each
frame could change its face definitions independently. */
......
......@@ -1136,7 +1136,6 @@ pop_kboard ()
#ifdef MULTI_KBOARD
struct device *d;
struct kboard_stack *p = kboard_stack;
int ok = 0;
current_kboard = NULL;
for (d = device_list; d; d = d->next_device)
{
......@@ -10739,6 +10738,7 @@ See also `current-input-mode'. */)
init_sys_modes (tty);
#endif
}
return Qnil;
}
DEFUN ("set-input-meta-mode", Fset_input_meta_mode, Sset_input_meta_mode, 1, 2, 0,
......
......@@ -37,6 +37,7 @@ EXFUN (Fcurrent_active_maps, 1);
extern Lisp_Object access_keymap P_ ((Lisp_Object, Lisp_Object, int, int, int));
extern Lisp_Object get_keyelt P_ ((Lisp_Object, int));
extern Lisp_Object get_keymap P_ ((Lisp_Object, int, int));
EXFUN (Fset_keymap_parent, 2);
extern void describe_map_tree P_ ((Lisp_Object, int, Lisp_Object, Lisp_Object,
char *, int, int, int, int));
extern int current_minor_maps P_ ((Lisp_Object **, Lisp_Object **));
......
......@@ -3184,6 +3184,9 @@ extern void syms_of_dired P_ ((void));
extern void syms_of_term P_ ((void));
extern void fatal () NO_RETURN;
/* Defined in terminal.c */
extern void syms_of_terminal P_ ((void));
#ifdef HAVE_X_WINDOWS
/* Defined in fontset.c */
extern void syms_of_fontset P_ ((void));
......
......@@ -1972,7 +1972,7 @@ reset_sys_modes (tty_out)
else
{ /* have to do it the hard way */
int i;
turn_off_insert (tty_out);
tty_turn_off_insert (tty_out);
for (i = curX (tty_out); i < FrameCols (tty_out) - 1; i++)
{
......
This diff is collapsed.
......@@ -330,6 +330,9 @@ struct device
the function `set-keyboard-coding-system'. */
struct coding_system *keyboard_coding;
/* Parameter alist of this terminal. */
Lisp_Object param_alist;
/* Terminal characteristics. */
/* XXX Are these really used on non-termcap displays? */
......
/* Functions related to terminal devices.
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Emacs.
GNU Emacs is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Emacs is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Emacs; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
#include <config.h>
#include "lisp.h"
#include "frame.h"
#include "termchar.h"
#include "termhooks.h"
#include "charset.h"
#include "coding.h"
#include "keyboard.h"
/* Chain of all displays currently in use. */
struct device *device_list;
/* The first unallocated display id. */
static int next_device_id;
/* The initial display device, created by initial_term_init. */
struct device *initial_device;
/* Function to use to ring the bell. */
Lisp_Object Vring_bell_function;
void delete_initial_device P_ ((struct device *));
void
ring_bell (struct frame *f)
{
if (!NILP (Vring_bell_function))
{
Lisp_Object function;
/* Temporarily set the global variable to nil
so that if we get an error, it stays nil
and we don't call it over and over.
We don't specbind it, because that would carefully
restore the bad value if there's an error
and make the loop of errors happen anyway. */
function = Vring_bell_function;
Vring_bell_function = Qnil;
call0 (function);
Vring_bell_function = function;
}
else if (FRAME_DEVICE (f)->ring_bell_hook)
(*FRAME_DEVICE (f)->ring_bell_hook) (f);
}
void
update_begin (struct frame *f)
{
if (FRAME_DEVICE (f)->update_begin_hook)
(*FRAME_DEVICE (f)->update_begin_hook) (f);
}
void
update_end (struct frame *f)
{
if (FRAME_DEVICE (f)->update_end_hook)
(*FRAME_DEVICE (f)->update_end_hook) (f);
}
/* Specify how many text lines, from the top of the window,
should be affected by insert-lines and delete-lines operations.
This, and those operations, are used only within an update
that is bounded by calls to update_begin and update_end. */
void
set_terminal_window (struct frame *f, int size)
{
if (FRAME_DEVICE (f)->set_terminal_window_hook)
(*FRAME_DEVICE (f)->set_terminal_window_hook) (f, size);
}