mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-04 06:31:13 -08:00
Fully eliminated global tty state variables.
lib-src/emacsclient.c (main.c): Fix error message. lisp/frame.el (make-frame-on-tty): New function. lisp/server.el (server-process-filter): Notify emacsclient if there was on error during evaluation. src/cm.c: Fix remaining cases of direct Wcm references. src/dispextern.h: Updated prototypes. src/dispnew.c (Fredraw_frame): Fix set_terminal_modes call. (init_display): Remove reference to meta_key. src/frame.c (make_terminal_frame): Renamed first parameter to tty_name. Call term_init before creating the frame. (Fmake_terminal_frame): Look up the `tty' and `tty-type' frame parameters from the currently selected terminal before the global default. (Fdelete_frame): Make sure that the new selected frame is live. src/keyboard.c (meta_key): Moved to struct tty_output. (read_avail_input): Fix C syntax. Update references to meta_key. (Fsuspend_emacs): pass current tty to init_sys_modes via record_unwind_protect. (Fset_input_mode): Update references to meta_key. (Fcurrent_input_mode): Ditto. src/sysdep.c (init_sys_modes): Updated old_tty and meta_key references. Don't call set_terminal_modes, it needs termcap strings. (reset_sys_modes): Call tty_reset_terminal_modes instead of reset_terminal_modes. Updated old_tty references. src/term.c: Massive updates throuout the file. (TS_*, TN_*): Moved to struct tty_output. (RPov, delete_in_insert_mode se_is_so, costs_set, insert_mode): Ditto. (standout_mode, specified_window, tty_cursor_hidden): Ditto. (tty_set_terminal_modes, tty_reset_terminal_modes): New functions. (turn_on_insert, turn_off_insert): Added tty parameter. (turn_on_highlight, turn_off_highlight, toggle_highlight): Added tty parameter. (tty_hide_cursor, tty_show_cursor): Ditto. (background_highlight, highlight_if_desired): Ditto. (tty_capable_p): Changed first parameter to tty_output. (term_init): Make sure top_frame is initialized. Don't exit on errors if this would have been a secondary terminal. Call set_terminal_modes on the end. (delete_tty): New function. (delete_tty_1): New function. (print_all_frames): New function, marginally useful for debugging. src/termchar.h (struct tty_output): Changed old_tty to be a pointer. Removed old_tty_valid member. Added tty-specific variables from term.c. src/xfaces.c (Ftty_supports_face_attributes_p): Update for new tty_capable_p. git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-9
This commit is contained in:
parent
6548cf002c
commit
fca177d467
13 changed files with 816 additions and 639 deletions
|
|
@ -27,8 +27,8 @@ STATUS
|
|||
Basic support is there; there are some rough edges, but it already
|
||||
seems to be usable. Input is read from all terminals (NOT via
|
||||
MULTIKBOARD!). At the moment, the type of the new terminals must be
|
||||
the same as the initial terminal. Emacsclient was extended to support
|
||||
opening a new terminal frame.
|
||||
the same as the initial terminal. Emacsclient has been extended to
|
||||
support opening a new terminal frame.
|
||||
|
||||
To try it out, start up the emacs server (M-x server-start), and then
|
||||
(from a shell prompt on another terminal) start emacsclient with
|
||||
|
|
@ -147,38 +147,68 @@ DIARY OF CHANGES
|
|||
(Done, emacsclient signals Emacs after writing to the proxy pseudo
|
||||
terminal. This means that multi-tty does not work with raw ttys!)
|
||||
|
||||
THINGS TO DO
|
||||
------------
|
||||
|
||||
** Implement sane error handling after initialization. (Currently
|
||||
-- Make make-terminal-frame look up the `tty' and `tty-type' frame
|
||||
parameters from the currently selected terminal before the global
|
||||
default.
|
||||
|
||||
(Done.)
|
||||
|
||||
-- Put all cached terminal escape sequences into struct tty_output.
|
||||
Currently, they are still stored in global variables, so we don't
|
||||
really support multiple terminal types.
|
||||
|
||||
(Done.)
|
||||
|
||||
-- Implement sane error handling after initialization. (Currently
|
||||
emacs exits if you specify a bad terminal type.) The helpful error
|
||||
messages must still be provided when Emacs starts.
|
||||
|
||||
** C-g should work on secondary terminals.
|
||||
(Done.)
|
||||
|
||||
** Make make-terminal-frame look up the tty and tty-type parameters
|
||||
from the currently selected terminal before the global default.
|
||||
-- Implement terminal deletion, i.e., deleting local frames, closing
|
||||
the tty device and restoring its previous state without exiting
|
||||
Emacs.
|
||||
|
||||
(Done, but at the moment only called when an error happens during
|
||||
initialization. There is a memory corruption error around this
|
||||
somewhere.)
|
||||
|
||||
|
||||
THINGS TO DO
|
||||
------------
|
||||
|
||||
** Fix mysterious memory corruption error with tty deletion. To
|
||||
trigger it, try the following shell command:
|
||||
|
||||
while true; do TERM=no-such-terminal-definition emacsclient -h; done
|
||||
|
||||
Emacs usually dumps core after a few dozen iterations. (The bug
|
||||
seems to be related to the xfree()ing or bzero()ing of
|
||||
tty_output.Wcm. Maybe there are outside references to struct Wcm?
|
||||
Sounds logical, otherwise these vars would not have been collected
|
||||
into a struct. But where?)
|
||||
|
||||
This does not seem to happen if the error occurs before terminal
|
||||
initialization or if I comment out all xfree()s in delete_frame.
|
||||
Update: yes it does, although it is much rarer.
|
||||
|
||||
** C-g should work on secondary terminals.
|
||||
|
||||
** Move optimalization parameters (costs) from union output_data to
|
||||
a backend-neutral per-device structure.
|
||||
|
||||
** Implement terminal deletion, i.e., deleting local frames, closing
|
||||
the tty device and restoring its previous state without exiting
|
||||
Emacs. This should be exported to the Lisp environment.
|
||||
|
||||
** Implement automatic deletion of terminals when the last frame on
|
||||
that terminal is closed.
|
||||
|
||||
** Put all cached terminal escape sequences into struct tty_output.
|
||||
Currently, they are still stored in global variables, so we don't
|
||||
really support multiple terminal types.
|
||||
|
||||
** Make parts of struct tty_output accessible from Lisp. The device
|
||||
name and the type is sufficient.
|
||||
|
||||
** Export delete_tty to the Lisp environment.
|
||||
|
||||
** Implement support for starting an interactive Emacs session without
|
||||
an initial frame. (The user would connect to it and open frames
|
||||
later, with emacsclient.) Not necessary a good idea.
|
||||
later, with emacsclient.) Not necessarily a good idea.
|
||||
|
||||
** Support raw secondary terminals. (This one is tricky, SIGIO works
|
||||
only on the controlling terminal.)
|
||||
|
|
|
|||
|
|
@ -1095,7 +1095,7 @@ To start the server in Emacs, type \"M-x server-start\".\n",
|
|||
if (emacs_pid == 0)
|
||||
{
|
||||
reset_tty ();
|
||||
fprintf (stderr, "%s: Could not get process id of Emacs\n", argv[0]);
|
||||
fprintf (stderr, "%s: %s\n", argv[0], str);
|
||||
fail (argc, argv);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -558,6 +558,24 @@ The optional second argument PARAMETERS specifies additional frame parameters."
|
|||
(error "Invalid display, not HOST:SERVER or HOST:SERVER.SCREEN"))
|
||||
(make-frame (cons (cons 'display display) parameters)))
|
||||
|
||||
;;;###autoload
|
||||
(defun make-frame-on-tty (device type &optional parameters)
|
||||
"Make a frame on terminal DEVICE which is of type TYPE (e.g., \"xterm\").
|
||||
The optional third argument PARAMETERS specifies additional frame parameters.
|
||||
|
||||
DEVICE must be a proxy psudo terminal created by emacsclient,
|
||||
otherwise there will be problems with terminal input and window
|
||||
resizes. (The kernel notifies processes about pending input or
|
||||
terminal resizes only on the controlling terminal, so we need
|
||||
emacsclient to sit on the real terminal device, create SIGIO
|
||||
signals upon terminal input, and forward SIGWINCH signals to
|
||||
us.)"
|
||||
(unless device
|
||||
(error "Invalid terminal device"))
|
||||
(unless type
|
||||
(error "Invalid terminal type"))
|
||||
(make-frame `((tty . ,device) (tty-type . ,type) . ,parameters)))
|
||||
|
||||
(defun make-frame-command ()
|
||||
"Make a new frame, and select it if the terminal displays only one frame."
|
||||
(interactive)
|
||||
|
|
|
|||
|
|
@ -345,12 +345,15 @@ PROC is the server process. Format of STRING is \"PATH PATH PATH... \\n\"."
|
|||
(if coding-system
|
||||
(setq arg (decode-coding-string arg coding-system)))
|
||||
(if eval
|
||||
(let ((v (eval (car (read-from-string arg)))))
|
||||
(when v
|
||||
(with-temp-buffer
|
||||
(let ((standard-output (current-buffer)))
|
||||
(pp v)
|
||||
(process-send-region proc (point-min) (point-max))))))
|
||||
(condition-case err
|
||||
(let ((v (eval (car (read-from-string arg)))))
|
||||
(when v
|
||||
(with-temp-buffer
|
||||
(let ((standard-output (current-buffer)))
|
||||
(pp v)
|
||||
(process-send-region proc (point-min) (point-max))))))
|
||||
(error (process-send-string proc (concat "*Error* " (error-message-string err)))))
|
||||
|
||||
;; ARG is a file name.
|
||||
;; Collapse multiple slashes to single slashes.
|
||||
(setq arg (command-line-normalize-file-name arg))
|
||||
|
|
|
|||
22
src/cm.c
22
src/cm.c
|
|
@ -83,9 +83,9 @@ cmputc (c)
|
|||
*/
|
||||
|
||||
static
|
||||
at (row, col) {
|
||||
curY = row;
|
||||
curX = col;
|
||||
at (tty, row, col) {
|
||||
curY (tty) = row;
|
||||
curX (tty) = col;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -93,8 +93,8 @@ at (row, col) {
|
|||
*/
|
||||
|
||||
static
|
||||
addcol (n) {
|
||||
curX += n;
|
||||
addcol (tty, n) {
|
||||
curX (tty) += n;
|
||||
|
||||
/*
|
||||
* If cursor hit edge of screen, what happened?
|
||||
|
|
@ -104,21 +104,21 @@ addcol (n) {
|
|||
* of the last line.
|
||||
*/
|
||||
|
||||
if (curX == Wcm.cm_cols) {
|
||||
if (curX (tty) == tty->Wcm->cm_cols) {
|
||||
/*
|
||||
* Well, if magicwrap, still there, past the edge of the
|
||||
* screen (!). If autowrap, on the col 0 of the next line.
|
||||
* Otherwise on last column.
|
||||
*/
|
||||
|
||||
if (Wcm.cm_magicwrap)
|
||||
if (tty->Wcm->cm_magicwrap)
|
||||
; /* "limbo" */
|
||||
else if (Wcm.cm_autowrap) {
|
||||
curX = 0;
|
||||
curY++; /* Beware end of screen! */
|
||||
else if (tty->Wcm->cm_autowrap) {
|
||||
curX (tty) = 0;
|
||||
curY (tty) ++; /* Beware end of screen! */
|
||||
}
|
||||
else
|
||||
curX--;
|
||||
curX (tty)--;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -2724,15 +2724,15 @@ extern Lisp_Object Qredisplay_dont_pause;
|
|||
/* Defined in term.c */
|
||||
|
||||
extern void ring_bell P_ ((void));
|
||||
extern void set_terminal_modes P_ (());
|
||||
extern void reset_terminal_modes P_ (());
|
||||
extern void set_terminal_modes P_ ((void));
|
||||
extern void reset_terminal_modes P_ ((void));
|
||||
extern void update_begin P_ ((struct frame *));
|
||||
extern void update_end P_ ((struct frame *));
|
||||
extern void set_terminal_window P_ ((int));
|
||||
extern void set_scroll_region P_ ((int, int));
|
||||
extern void turn_off_insert P_ ((void));
|
||||
extern void turn_off_highlight P_ ((void));
|
||||
extern void background_highlight P_ ((void));
|
||||
extern void turn_off_insert P_ ((struct tty_output *));
|
||||
extern void turn_off_highlight P_ ((struct tty_output *));
|
||||
extern void background_highlight P_ ((struct tty_output *));
|
||||
extern void clear_frame P_ ((void));
|
||||
extern void clear_end_of_line P_ ((int));
|
||||
extern void clear_end_of_line_raw P_ ((int));
|
||||
|
|
@ -2742,12 +2742,12 @@ extern int string_cost P_ ((char *));
|
|||
extern int per_line_cost P_ ((char *));
|
||||
extern void calculate_costs P_ ((struct frame *));
|
||||
extern void set_tty_color_mode P_ ((struct frame *, Lisp_Object));
|
||||
extern void tty_setup_colors P_ ((int));
|
||||
extern void tty_setup_colors P_ ((struct tty_output *, int));
|
||||
extern struct tty_output *term_init P_ ((char *, char *));
|
||||
extern struct tty_output *term_dummy_init P_ ((void));
|
||||
extern void fatal P_ ((/* char *, ... */));
|
||||
void cursor_to P_ ((int, int));
|
||||
extern int tty_capable_p P_ ((struct frame *, unsigned, unsigned long, unsigned long));
|
||||
extern int tty_capable_p P_ ((struct tty_output *, unsigned, unsigned long, unsigned long));
|
||||
|
||||
/* Defined in scroll.c */
|
||||
|
||||
|
|
|
|||
|
|
@ -3313,7 +3313,7 @@ DEFUN ("redraw-frame", Fredraw_frame, Sredraw_frame, 1, 1, 0,
|
|||
|
||||
update_begin (f);
|
||||
if (FRAME_MSDOS_P (f))
|
||||
set_terminal_modes (0);
|
||||
set_terminal_modes ();
|
||||
clear_frame ();
|
||||
clear_current_matrices (f);
|
||||
update_end (f);
|
||||
|
|
@ -6485,7 +6485,6 @@ init_display ()
|
|||
SET_CHAR_GLYPH_FROM_GLYPH (space_glyph, ' ');
|
||||
space_glyph.charpos = -1;
|
||||
|
||||
meta_key = 0;
|
||||
inverse_video = 0;
|
||||
cursor_in_echo_area = 0;
|
||||
terminal_type = (char *) 0;
|
||||
|
|
|
|||
22
src/frame.c
22
src/frame.c
|
|
@ -478,14 +478,21 @@ make_minibuffer_frame ()
|
|||
static int terminal_frame_count;
|
||||
|
||||
struct frame *
|
||||
make_terminal_frame (tty, tty_type)
|
||||
char *tty;
|
||||
make_terminal_frame (tty_name, tty_type)
|
||||
char *tty_name;
|
||||
char *tty_type;
|
||||
{
|
||||
register struct frame *f;
|
||||
Lisp_Object frame;
|
||||
char name[20];
|
||||
struct tty_output *tty;
|
||||
|
||||
/* init_term may throw an error, so create the tty first. */
|
||||
if (initialized)
|
||||
tty = term_init (tty_name, tty_type);
|
||||
else
|
||||
tty = term_dummy_init ();
|
||||
|
||||
#ifdef MULTI_KBOARD
|
||||
if (!initial_kboard)
|
||||
{
|
||||
|
|
@ -544,10 +551,7 @@ make_terminal_frame (tty, tty_type)
|
|||
make_mac_terminal_frame (f);
|
||||
#else
|
||||
f->output_method = output_termcap;
|
||||
if (initialized)
|
||||
f->output_data.tty = term_init (tty, tty_type);
|
||||
else
|
||||
f->output_data.tty = term_dummy_init ();
|
||||
f->output_data.tty = tty;
|
||||
f->output_data.tty->top_frame = frame;
|
||||
#ifdef CANNOT_DUMP
|
||||
FRAME_FOREGROUND_PIXEL(f) = FACE_TTY_DEFAULT_FG_COLOR;
|
||||
|
|
@ -607,6 +611,8 @@ Note that changing the size of one terminal frame automatically affects all. */
|
|||
|
||||
/* XXX Ugh, there must be a better way to do this. */
|
||||
tty = Fassq (Qtty, parms);
|
||||
if (EQ (tty, Qnil))
|
||||
tty = Fassq (Qtty, XFRAME (selected_frame)->param_alist);
|
||||
if (EQ (tty, Qnil))
|
||||
tty = Fassq (Qtty, Vdefault_frame_alist);
|
||||
if (! EQ (tty, Qnil))
|
||||
|
|
@ -617,6 +623,8 @@ Note that changing the size of one terminal frame automatically affects all. */
|
|||
tty_type = Fassq (Qtty_type, parms);
|
||||
if (EQ (tty_type, Qnil))
|
||||
tty_type = Fassq (Qtty_type, Vdefault_frame_alist);
|
||||
if (EQ (tty_type, Qnil))
|
||||
tty_type = Fassq (Qtty, XFRAME (selected_frame)->param_alist);
|
||||
if (! EQ (tty_type, Qnil))
|
||||
tty_type = XCDR (tty_type);
|
||||
if (EQ (tty_type, Qnil) || !STRINGP (tty_type))
|
||||
|
|
@ -1300,7 +1308,7 @@ The functions are run with one arg, the frame to be deleted. */)
|
|||
{
|
||||
FOR_EACH_FRAME (tail, frame1)
|
||||
{
|
||||
if (! EQ (frame, frame1))
|
||||
if (! EQ (frame, frame1) && FRAME_LIVE_P (XFRAME (frame1)))
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -461,11 +461,6 @@ FILE *dribble;
|
|||
/* Nonzero if input is available. */
|
||||
int input_pending;
|
||||
|
||||
/* 1 if should obey 0200 bit in input chars as "Meta", 2 if should
|
||||
keep 0200 bit in input chars. 0 to ignore the 0200 bit. */
|
||||
|
||||
int meta_key;
|
||||
|
||||
/* Non-zero means force key bindings update in parse_menu_item. */
|
||||
|
||||
int update_menu_bindings;
|
||||
|
|
@ -6593,7 +6588,9 @@ read_avail_input (expected)
|
|||
of characters on some systems when input is stuffed at us. */
|
||||
unsigned char cbuf[KBD_BUFFER_SIZE - 1];
|
||||
int n_to_read;
|
||||
|
||||
struct tty_output *tty;
|
||||
Lisp_Object frame;
|
||||
|
||||
#ifdef WINDOWSNT
|
||||
return 0;
|
||||
#else /* not WINDOWSNT */
|
||||
|
|
@ -6607,12 +6604,14 @@ read_avail_input (expected)
|
|||
|
||||
#else /* not MSDOS */
|
||||
|
||||
struct tty_output *tty;
|
||||
nread = 0;
|
||||
|
||||
/* Try to read from each available tty, until one succeeds. */
|
||||
for (tty = tty_list; tty; tty = tty->next) {
|
||||
|
||||
|
||||
if (! tty->term_initted)
|
||||
continue;
|
||||
|
||||
/* Determine how many characters we should *try* to read. */
|
||||
#ifdef FIONREAD
|
||||
/* Find out how much input is available. */
|
||||
|
|
@ -6720,15 +6719,15 @@ read_avail_input (expected)
|
|||
/* Select frame corresponding to the active tty. Note that the
|
||||
value of selected_frame is not reliable here, redisplay tends
|
||||
to temporarily change it. But tty should always be non-NULL. */
|
||||
Lisp_Object frame = (tty ? tty->top_frame : selected_frame);
|
||||
|
||||
frame = (tty ? tty->top_frame : selected_frame);
|
||||
|
||||
for (i = 0; i < nread; i++)
|
||||
{
|
||||
buf[i].kind = ASCII_KEYSTROKE_EVENT;
|
||||
buf[i].modifiers = 0;
|
||||
if (meta_key == 1 && (cbuf[i] & 0x80))
|
||||
if (tty->meta_key == 1 && (cbuf[i] & 0x80))
|
||||
buf[i].modifiers = meta_modifier;
|
||||
if (meta_key != 2)
|
||||
if (tty->meta_key != 2)
|
||||
cbuf[i] &= ~0x80;
|
||||
|
||||
buf[i].code = cbuf[i];
|
||||
|
|
@ -10109,7 +10108,7 @@ On such systems, Emacs starts a subshell instead of suspending. */)
|
|||
/* sys_suspend can get an error if it tries to fork a subshell
|
||||
and the system resources aren't available for that. */
|
||||
record_unwind_protect ((Lisp_Object (*) P_ ((Lisp_Object))) init_sys_modes,
|
||||
Qnil);
|
||||
(Lisp_Object)CURTTY()); /* XXX */
|
||||
stuff_buffered_input (stuffstring);
|
||||
if (cannot_suspend)
|
||||
sys_subshell ();
|
||||
|
|
@ -10438,14 +10437,14 @@ See also `current-input-mode'. */)
|
|||
|
||||
flow_control = !NILP (flow);
|
||||
if (NILP (meta))
|
||||
meta_key = 0;
|
||||
FRAME_TTY (SELECTED_FRAME ())->meta_key = 0;
|
||||
else if (EQ (meta, Qt))
|
||||
meta_key = 1;
|
||||
FRAME_TTY (SELECTED_FRAME ())->meta_key = 1;
|
||||
else
|
||||
meta_key = 2;
|
||||
FRAME_TTY (SELECTED_FRAME ())->meta_key = 2;
|
||||
if (!NILP (quit))
|
||||
/* Don't let this value be out of range. */
|
||||
quit_char = XINT (quit) & (meta_key ? 0377 : 0177);
|
||||
quit_char = XINT (quit) & (FRAME_TTY (SELECTED_FRAME ())->meta_key ? 0377 : 0177);
|
||||
|
||||
#ifndef DOS_NT
|
||||
init_all_sys_modes ();
|
||||
|
|
@ -10478,7 +10477,9 @@ The elements of this list correspond to the arguments of
|
|||
|
||||
val[0] = interrupt_input ? Qt : Qnil;
|
||||
val[1] = flow_control ? Qt : Qnil;
|
||||
val[2] = meta_key == 2 ? make_number (0) : meta_key == 1 ? Qt : Qnil;
|
||||
val[2] = FRAME_TTY (SELECTED_FRAME ())->meta_key == 2
|
||||
? make_number (0)
|
||||
: FRAME_TTY (SELECTED_FRAME ())->meta_key == 1 ? Qt : Qnil;
|
||||
XSETFASTINT (val[3], quit_char);
|
||||
|
||||
return Flist (sizeof (val) / sizeof (val[0]), val);
|
||||
|
|
|
|||
20
src/sysdep.c
20
src/sysdep.c
|
|
@ -1362,14 +1362,15 @@ nil means don't delete them until `list-processes' is run. */);
|
|||
if (!read_socket_hook && EQ (Vwindow_system, Qnil))
|
||||
#endif
|
||||
{
|
||||
EMACS_GET_TTY (fileno (TTY_INPUT (tty_out)), &tty_out->old_tty);
|
||||
if (! tty_out->old_tty)
|
||||
tty_out->old_tty = (struct emacs_tty *) xmalloc (sizeof (struct emacs_tty));
|
||||
|
||||
EMACS_GET_TTY (fileno (TTY_INPUT (tty_out)), tty_out->old_tty);
|
||||
|
||||
tty_out->old_tty_valid = 1;
|
||||
|
||||
tty = tty_out->old_tty;
|
||||
tty = *tty_out->old_tty;
|
||||
|
||||
#if defined (HAVE_TERMIO) || defined (HAVE_TERMIOS)
|
||||
XSETINT (Vtty_erase_char, tty_out->old_tty.main.c_cc[VERASE]);
|
||||
XSETINT (Vtty_erase_char, tty.main.c_cc[VERASE]);
|
||||
|
||||
#ifdef DGUX
|
||||
/* This allows meta to be sent on 8th bit. */
|
||||
|
|
@ -1403,7 +1404,7 @@ nil means don't delete them until `list-processes' is run. */);
|
|||
on output */
|
||||
tty.main.c_oflag &= ~TAB3; /* Disable tab expansion */
|
||||
#ifdef CS8
|
||||
if (meta_key)
|
||||
if (tty_out->meta_key)
|
||||
{
|
||||
tty.main.c_cflag |= CS8; /* allow 8th bit on input */
|
||||
tty.main.c_cflag &= ~PARENB;/* Don't check parity */
|
||||
|
|
@ -1641,7 +1642,6 @@ nil means don't delete them until `list-processes' is run. */);
|
|||
#endif
|
||||
)
|
||||
#endif
|
||||
set_terminal_modes (tty_out);
|
||||
|
||||
if (!tty_out->term_initted)
|
||||
{
|
||||
|
|
@ -1838,7 +1838,7 @@ reset_sys_modes (tty_out)
|
|||
}
|
||||
#endif
|
||||
|
||||
reset_terminal_modes (tty_out);
|
||||
tty_reset_terminal_modes (tty_out);
|
||||
fflush (TTY_OUTPUT (tty_out));
|
||||
#ifdef BSD_SYSTEM
|
||||
#ifndef BSD4_1
|
||||
|
|
@ -1867,9 +1867,9 @@ reset_sys_modes (tty_out)
|
|||
reset_sigio ();
|
||||
#endif /* BSD4_1 */
|
||||
|
||||
if (tty_out->old_tty_valid)
|
||||
if (tty_out->old_tty)
|
||||
while (EMACS_SET_TTY (fileno (TTY_INPUT (tty_out)),
|
||||
&tty_out->old_tty, 0) < 0 && errno == EINTR)
|
||||
tty_out->old_tty, 0) < 0 && errno == EINTR)
|
||||
;
|
||||
|
||||
#ifdef MSDOS /* Demacs 1.1.2 91/10/20 Manabu Higashida */
|
||||
|
|
|
|||
1116
src/term.c
1116
src/term.c
File diff suppressed because it is too large
Load diff
120
src/termchar.h
120
src/termchar.h
|
|
@ -1,5 +1,5 @@
|
|||
/* Flags and parameters describing terminal's characteristics.
|
||||
Copyright (C) 1985, 1986 Free Software Foundation, Inc.
|
||||
Copyright (C) 1985, 1986, 2003 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Emacs.
|
||||
|
||||
|
|
@ -35,10 +35,9 @@ struct tty_output
|
|||
FILE *termscript; /* If nonzero, send all terminal output
|
||||
characters to this stream also. */
|
||||
|
||||
struct emacs_tty old_tty; /* The initial tty mode bits */
|
||||
struct emacs_tty *old_tty; /* The initial tty mode bits */
|
||||
|
||||
int term_initted; /* 1 if we have been through init_sys_modes. */
|
||||
int old_tty_valid; /* 1 if outer tty status has been recorded. */
|
||||
|
||||
|
||||
/* Structure for info on cursor positioning. */
|
||||
|
|
@ -47,7 +46,7 @@ struct tty_output
|
|||
|
||||
/* Redisplay. */
|
||||
|
||||
/* XXX This may cause problems with GC. */
|
||||
/* XXX GC does not know about this; is this a problem? */
|
||||
Lisp_Object top_frame; /* The topmost frame on this tty. */
|
||||
|
||||
/* The previous terminal frame we displayed on this tty. */
|
||||
|
|
@ -82,6 +81,119 @@ struct tty_output
|
|||
various cost tables; we won't use them. */
|
||||
#endif
|
||||
|
||||
/* Strings, numbers and flags taken from the termcap entry. */
|
||||
|
||||
char *TS_ins_line; /* "al" */
|
||||
char *TS_ins_multi_lines; /* "AL" (one parameter, # lines to insert) */
|
||||
char *TS_bell; /* "bl" */
|
||||
char *TS_clr_to_bottom; /* "cd" */
|
||||
char *TS_clr_line; /* "ce", clear to end of line */
|
||||
char *TS_clr_frame; /* "cl" */
|
||||
char *TS_set_scroll_region; /* "cs" (2 params, first line and last line) */
|
||||
char *TS_set_scroll_region_1; /* "cS" (4 params: total lines,
|
||||
lines above scroll region, lines below it,
|
||||
total lines again) */
|
||||
char *TS_del_char; /* "dc" */
|
||||
char *TS_del_multi_chars; /* "DC" (one parameter, # chars to delete) */
|
||||
char *TS_del_line; /* "dl" */
|
||||
char *TS_del_multi_lines; /* "DL" (one parameter, # lines to delete) */
|
||||
char *TS_delete_mode; /* "dm", enter character-delete mode */
|
||||
char *TS_end_delete_mode; /* "ed", leave character-delete mode */
|
||||
char *TS_end_insert_mode; /* "ei", leave character-insert mode */
|
||||
char *TS_ins_char; /* "ic" */
|
||||
char *TS_ins_multi_chars; /* "IC" (one parameter, # chars to insert) */
|
||||
char *TS_insert_mode; /* "im", enter character-insert mode */
|
||||
char *TS_pad_inserted_char; /* "ip". Just padding, no commands. */
|
||||
char *TS_end_keypad_mode; /* "ke" */
|
||||
char *TS_keypad_mode; /* "ks" */
|
||||
char *TS_pad_char; /* "pc", char to use as padding */
|
||||
char *TS_repeat; /* "rp" (2 params, # times to repeat
|
||||
and character to be repeated) */
|
||||
char *TS_end_standout_mode; /* "se" */
|
||||
char *TS_fwd_scroll; /* "sf" */
|
||||
char *TS_standout_mode; /* "so" */
|
||||
char *TS_rev_scroll; /* "sr" */
|
||||
char *TS_end_termcap_modes; /* "te" */
|
||||
char *TS_termcap_modes; /* "ti" */
|
||||
char *TS_visible_bell; /* "vb" */
|
||||
char *TS_cursor_normal; /* "ve" */
|
||||
char *TS_cursor_visible; /* "vs" */
|
||||
char *TS_cursor_invisible; /* "vi" */
|
||||
char *TS_set_window; /* "wi" (4 params, start and end of window,
|
||||
each as vpos and hpos) */
|
||||
|
||||
char *TS_enter_bold_mode; /* "md" -- turn on bold (extra bright mode). */
|
||||
char *TS_enter_dim_mode; /* "mh" -- turn on half-bright mode. */
|
||||
char *TS_enter_blink_mode; /* "mb" -- enter blinking mode. */
|
||||
char *TS_enter_reverse_mode; /* "mr" -- enter reverse video mode. */
|
||||
char *TS_exit_underline_mode; /* "us" -- start underlining. */
|
||||
char *TS_enter_underline_mode; /* "ue" -- end underlining. */
|
||||
|
||||
/* "as"/"ae" -- start/end alternate character set. Not really
|
||||
supported, yet. */
|
||||
char *TS_enter_alt_charset_mode;
|
||||
char *TS_exit_alt_charset_mode;
|
||||
|
||||
char *TS_exit_attribute_mode; /* "me" -- switch appearances off. */
|
||||
|
||||
/* Value of the "NC" (no_color_video) capability, or 0 if not present. */
|
||||
int TN_no_color_video;
|
||||
|
||||
int TN_max_colors; /* "Co" -- number of colors. */
|
||||
|
||||
/* "pa" -- max. number of color pairs on screen. Not handled yet.
|
||||
Could be a problem if not equal to TN_max_colors * TN_max_colors. */
|
||||
int TN_max_pairs;
|
||||
|
||||
/* "op" -- SVr4 set default pair to its original value. */
|
||||
char *TS_orig_pair;
|
||||
|
||||
/* "AF"/"AB" or "Sf"/"Sb"-- set ANSI or SVr4 foreground/background color.
|
||||
1 param, the color index. */
|
||||
char *TS_set_foreground;
|
||||
char *TS_set_background;
|
||||
|
||||
int TF_hazeltine; /* termcap hz flag. */
|
||||
int TF_insmode_motion; /* termcap mi flag: can move while in insert mode. */
|
||||
int TF_standout_motion; /* termcap mi flag: can move while in standout mode. */
|
||||
int TF_underscore; /* termcap ul flag: _ underlines if over-struck on
|
||||
non-blank position. Must clear before writing _. */
|
||||
int TF_teleray; /* termcap xt flag: many weird consequences.
|
||||
For t1061. */
|
||||
|
||||
int RPov; /* # chars to start a TS_repeat */
|
||||
|
||||
int delete_in_insert_mode; /* delete mode == insert mode */
|
||||
|
||||
int se_is_so; /* 1 if same string both enters and leaves
|
||||
standout mode */
|
||||
|
||||
int costs_set; /* Nonzero if costs have been calculated. */
|
||||
|
||||
int insert_mode; /* Nonzero when in insert mode. */
|
||||
int standout_mode; /* Nonzero when in standout mode. */
|
||||
|
||||
|
||||
|
||||
/* 1 if should obey 0200 bit in input chars as "Meta", 2 if should
|
||||
keep 0200 bit in input chars. 0 to ignore the 0200 bit. */
|
||||
|
||||
int meta_key;
|
||||
|
||||
/* Size of window specified by higher levels.
|
||||
This is the number of lines, from the top of frame downwards,
|
||||
which can participate in insert-line/delete-line operations.
|
||||
|
||||
Effectively it excludes the bottom frame_lines - specified_window_size
|
||||
lines from those operations. */
|
||||
|
||||
int specified_window;
|
||||
|
||||
/* Flag used in tty_show/hide_cursor. */
|
||||
|
||||
int cursor_hidden;
|
||||
|
||||
|
||||
struct tty_output *next;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -5333,7 +5333,7 @@ substitution of a `dim' face for italic. */)
|
|||
/* See if the capabilities we selected above are supported, with the
|
||||
given colors. */
|
||||
if (test_caps != 0 &&
|
||||
! tty_capable_p (f, test_caps, fg_tty_color.pixel, bg_tty_color.pixel))
|
||||
! tty_capable_p (FRAME_TTY (SELECTED_FRAME ()), test_caps, fg_tty_color.pixel, bg_tty_color.pixel))
|
||||
return Qnil;
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue