Commit 6548cf00 authored by Karoly Lorentey's avatar Karoly Lorentey

Full support for multiple terminal I/O (with some rough edges).

lib-src/emacsclient.c (emacs_pid): New variable.  
(window_change): Forward the SIGWINCH signal to the Emacs process
after copying the size parameters to the proxy terminal.
(copy_from_to): New parameter (sigio), kill Emacs with SIGIO if it is
nonzero.
(main): Set emacs_pid.

lisp/server.el (server-process-filter): Send the pid of Emacs to emacsclient.

src/cm.c: Added tty parameters to all functions and all Wcm macro calls.

src/cm.h: Added tty parameters to all macros.   Updated function prototypes.
(Wcm): Moved to struct tty_output.

src/dispextern.h: Updated function prototypes.

src/dispnew.c: Added tty parameters to all Wcm macro calls.
(do_switch_frame): Make old frame obscured, not invisible, to solve
problems with other-frame.
(Wcm): Moved to struct tty_output.

src/keyboard.c (read_avail_input): Select the frame corresponding to
the tty that was read.  Slight rearrangement of tty loop.

src/lisp.h (tabs_safe_p): Removed duplicate prototype.

src/sysdep.c (hft_init, hft_reset): Added tty_output parameter.
(discard_tty_input): Discard input from all ttys on APOLLO, too.
Whatever it is.
(narrow_foreground_group, widen_foreground_group): Added tty parameter
(not really useful, the functions only work on the controlling tty.)
(tabs_safe_p): Added tty parameter.

src/term.c Added tty parameters to all Wcm macro calls.
Standardised updating_frame vs. selected frame and tty_output access.
(term_init): Allocate Wcm.
(syms_of_term): Provide the `multi-tty' feature.

src/termchar.h (struct tty_output): Added Wcm.

src/xdisp.c (try_window_id): Make sure we use the tty device
corresponding to the current frame.

git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-8
parent ce9d5d59
......@@ -13,7 +13,7 @@ I'm Károly Lőrentey. My address: lorentey@elte.hu.
Patches or suggestions are welcome!
Retrieving the branch:
Retrieving the latest version of the branch:
tla register-archive lorentey@elte.hu--2004 http://lorentey.web.elte.hu/arch/2004/
tla get lorentey@elte.hu--2004/emacs--multi-tty--0 <directory>
......@@ -24,21 +24,24 @@ Retrieving the branch:
STATUS
------
We can create frames on new tty devices, but there are problems with
redisplay. 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 is extended to support opening a new
terminal frame.
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.
To try it out, start up the emacs server (M-x server-start), and then
start emacsclient with
(from a shell prompt on another terminal) start emacsclient with
emacsclient -h
If you exit emacs, both terminals are restored to their previous
You'll have two fully working frames on separate terminals. If you
exit emacs, both terminals should be restored to their previous
states.
X, Mac, Windows and DOS support is broken.
X, Mac, Windows and DOS support is broken at the moment.
Tested under GNU/Linux only.
NEWS
----
......@@ -47,7 +50,19 @@ For the NEWS file:
** Support for multiple terminal devices has been added. You can
specify a terminal device (`tty' parameter) and a terminal type
(`tty-type' parameter) to `make-terminal-frame'.
(`tty-type' parameter) to `make-terminal-frame'. `tty' must be a
terminal device created by the new emacsclient, or 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.)
You can test for the presence of multiple terminal support by
testing for the `multi-tty' feature.
** A make-frame-on-tty function has been added to make it easier to
create frames on new terminals.
** Emacsclient has been extended to support opening a new terminal
frame.
......@@ -58,8 +73,10 @@ CHANGELOG
See arch logs.
THINGS THAT ARE DONE
--------------------
DIARY OF CHANGES
----------------
(ex-TODO items with explanations.)
-- Introduce a new abstraction for terminal devices.
......@@ -80,12 +97,13 @@ THINGS THAT ARE DONE
-- Implement support for reading from multiple terminals.
(Done, read_avail_input tries to read from each terminal, until one
succeeds.)
succeeds. MULTIKBOARD is not used. Secondary terminals don't send
SIGIO!)
-- other-frame should cycle through the frames on the `current'
terminal.
terminal only.
(Done. A little fragile, but seems to work.)
(Done, by trivially modifiying next_frame and prev_frame.)
-- Support different terminal sizes.
......@@ -94,7 +112,8 @@ THINGS THAT ARE DONE
-- Make sure terminal resizes are handled gracefully. (Could be
problematic.)
(Done. We don't get SIGWINCH for additional ttys, though.)
(Done. We don't get automatic SIGWINCH for additional ttys,
though.)
-- Extend emacsclient to automatically open a new tty when it connects
to Emacs.
......@@ -106,46 +125,71 @@ THINGS THAT ARE DONE
(Done, but introduced ugly redisplay problems. Ugh.)
-- Fix redisplay problems.
(Done, it turned out that the entire Wcm structure must be moved
inside tty_output. Why was it so hard for me to find this out?)
-- Provide a way for emacsclient to tell Emacs that the tty has been
resized.
(Done, simply forward the SIGWINCH signal.)
-- Each keypress should automatically select the frame corresponding
to the terminal that it was coming from. This means that Emacs
must know from which terminal the last keyboard event came from.
(Multikeyboard support may help with this.)
(Done, it was quite simple.)
-- Fix SIGIO issue with secondary terminals.
(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
------------
** Fix redisplay problems.
** 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.
** Make make-terminal-frame look up the tty and tty-type parameters
from the currently selected terminal before the global default.
** Move optimalization parameters (costs) from union output_data to
struct frame.
a backend-neutral per-device structure.
** Provide a way for emacsclient to tell Emacs that the tty has been
resized.
** 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 terminal deletion, i.e., closing the tty device and
restoring its previous state without exiting Emacs. This should be
exported to the Lisp interpreter.
** Implement automatic deletion of terminals, when the last frame on
** 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.
** Each keypress should automatically select the frame corresponding
to the terminal that it was coming from. This means that Emacs
must know from which terminal the last keyboard event came from.
(Multikeyboard support may help with this.)
** Make struct tty_output available from Lisp.
** Make parts of struct tty_output accessible from Lisp. The device
name and the type is sufficient.
** 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.
** Support raw secondary terminals. (This one is tricky, SIGIO works
only on the controlling terminal.)
** What does interrupt_input do? I tried to disable it for raw
secondary tty support, but it seems not to do anything useful.
** Fix X support.
** Do tty output through term_hooks, too.
** Allow simultaneous X and tty frames.
** Fix Mac support (I can't do this myself).
......
......@@ -380,6 +380,7 @@ int tty_erase_char;
int flow_control = 0;
int meta_key = 0;
char _sobuf[BUFSIZ];
int emacs_pid;
/* Adapted from init_sys_modes() in sysdep.c. */
int
......@@ -548,7 +549,7 @@ init_tty ()
void
window_change ()
{
int width, height;
int width = 0, height = 0;
#ifdef TIOCGWINSZ
{
......@@ -601,6 +602,9 @@ window_change ()
}
#endif /* not SunOS-style */
#endif /* not BSD-style */
if (width != 0 && height != 0)
kill (emacs_pid, SIGWINCH);
}
int in_conversation = 0;
......@@ -696,7 +700,7 @@ init_pty ()
}
int
copy_from_to (int in, int out)
copy_from_to (int in, int out, int sigio)
{
static char buf[BUFSIZ];
int nread = read (in, &buf, BUFSIZ);
......@@ -716,6 +720,11 @@ copy_from_to (int in, int out)
if (r < 0)
return 0; /* Error */
if (sigio)
{
kill (emacs_pid, SIGIO);
}
}
return 1;
}
......@@ -744,13 +753,13 @@ pty_conversation ()
if (FD_ISSET (master, &set))
{
/* Copy Emacs output to stdout. */
if (! copy_from_to (master, 0))
if (! copy_from_to (master, 0, 0))
return 1;
}
if (FD_ISSET (1, &set))
{
/* Forward user input to Emacs. */
if (! copy_from_to (1, master))
if (! copy_from_to (1, master, 1))
return 1;
}
}
......@@ -1078,6 +1087,18 @@ To start the server in Emacs, type \"M-x server-start\".\n",
if (here)
{
/* First of all, get the pid of the Emacs process.
XXX Is there is some nifty libc/kernel feature for doing this?
*/
str = fgets (string, BUFSIZ, in);
emacs_pid = atoi (str);
if (emacs_pid == 0)
{
reset_tty ();
fprintf (stderr, "%s: Could not get process id of Emacs\n", argv[0]);
fail (argc, argv);
}
if (! pty_conversation ())
{
reset_tty ();
......
......@@ -319,13 +319,15 @@ PROC is the server process. Format of STRING is \"PATH PATH PATH... \\n\"."
(server-select-display display)
(error (process-send-string proc (nth 1 err))
(setq request "")))))
;; Open a new tty at the client.
;; Open a new frame at the client. ARG is the name of the pseudo tty.
((and (equal "-pty" arg) (string-match "\\([^ ]*\\) \\([^ ]*\\) " request))
(let ((pty (server-unquote-arg (match-string 1 request)))
(type (server-unquote-arg (match-string 2 request))))
(setq request (substring request (match-end 0)))
(condition-case err
(make-terminal-frame `((tty . ,pty) (tty-type . ,type)))
(progn
(make-terminal-frame `((tty . ,pty) (tty-type . ,type)))
(process-send-string proc (concat (number-to-string (emacs-pid)) "\n")))
(error (process-send-string proc (nth 1 err))
(setq request "")))))
;; ARG is a line number option.
......
This diff is collapsed.
......@@ -98,66 +98,65 @@ struct cm
int cc_vabs;
};
extern struct cm Wcm; /* Terminal capabilities */
extern char PC; /* Pad character */
/* Shorthand */
#ifndef NoCMShortHand
#define curY Wcm.cm_curY
#define curX Wcm.cm_curX
#define Up Wcm.cm_up
#define Down Wcm.cm_down
#define Left Wcm.cm_left
#define Right Wcm.cm_right
#define Tab Wcm.cm_tab
#define BackTab Wcm.cm_backtab
#define TabWidth Wcm.cm_tabwidth
#define CR Wcm.cm_cr
#define Home Wcm.cm_home
#define LastLine Wcm.cm_ll
#define AbsPosition Wcm.cm_abs
#define ColPosition Wcm.cm_habs
#define RowPosition Wcm.cm_vabs
#define MultiUp Wcm.cm_multiup
#define MultiDown Wcm.cm_multidown
#define MultiLeft Wcm.cm_multileft
#define MultiRight Wcm.cm_multiright
#define AutoWrap Wcm.cm_autowrap
#define MagicWrap Wcm.cm_magicwrap
#define UseTabs Wcm.cm_usetabs
#define FrameRows Wcm.cm_rows
#define FrameCols Wcm.cm_cols
#define UpCost Wcm.cc_up
#define DownCost Wcm.cc_down
#define LeftCost Wcm.cc_left
#define RightCost Wcm.cc_right
#define HomeCost Wcm.cc_home
#define CRCost Wcm.cc_cr
#define LastLineCost Wcm.cc_ll
#define TabCost Wcm.cc_tab
#define BackTabCost Wcm.cc_backtab
#define AbsPositionCost Wcm.cc_abs
#define ColPositionCost Wcm.cc_habs
#define RowPositionCost Wcm.cc_vabs
#define MultiUpCost Wcm.cc_multiup
#define MultiDownCost Wcm.cc_multidown
#define MultiLeftCost Wcm.cc_multileft
#define MultiRightCost Wcm.cc_multiright
#define curY(tty) (tty)->Wcm->cm_curY
#define curX(tty) (tty)->Wcm->cm_curX
#define Up(tty) (tty)->Wcm->cm_up
#define Down(tty) (tty)->Wcm->cm_down
#define Left(tty) (tty)->Wcm->cm_left
#define Right(tty) (tty)->Wcm->cm_right
#define Tab(tty) (tty)->Wcm->cm_tab
#define BackTab(tty) (tty)->Wcm->cm_backtab
#define TabWidth(tty) (tty)->Wcm->cm_tabwidth
#define CR(tty) (tty)->Wcm->cm_cr
#define Home(tty) (tty)->Wcm->cm_home
#define LastLine(tty) (tty)->Wcm->cm_ll
#define AbsPosition(tty) (tty)->Wcm->cm_abs
#define ColPosition(tty) (tty)->Wcm->cm_habs
#define RowPosition(tty) (tty)->Wcm->cm_vabs
#define MultiUp(tty) (tty)->Wcm->cm_multiup
#define MultiDown(tty) (tty)->Wcm->cm_multidown
#define MultiLeft(tty) (tty)->Wcm->cm_multileft
#define MultiRight(tty) (tty)->Wcm->cm_multiright
#define AutoWrap(tty) (tty)->Wcm->cm_autowrap
#define MagicWrap(tty) (tty)->Wcm->cm_magicwrap
#define UseTabs(tty) (tty)->Wcm->cm_usetabs
#define FrameRows(tty) (tty)->Wcm->cm_rows
#define FrameCols(tty) (tty)->Wcm->cm_cols
#define UpCost(tty) (tty)->Wcm->cc_up
#define DownCost(tty) (tty)->Wcm->cc_down
#define LeftCost(tty) (tty)->Wcm->cc_left
#define RightCost(tty) (tty)->Wcm->cc_right
#define HomeCost(tty) (tty)->Wcm->cc_home
#define CRCost(tty) (tty)->Wcm->cc_cr
#define LastLineCost(tty) (tty)->Wcm->cc_ll
#define TabCost(tty) (tty)->Wcm->cc_tab
#define BackTabCost(tty) (tty)->Wcm->cc_backtab
#define AbsPositionCost(tty) (tty)->Wcm->cc_abs
#define ColPositionCost(tty) (tty)->Wcm->cc_habs
#define RowPositionCost(tty) (tty)->Wcm->cc_vabs
#define MultiUpCost(tty) (tty)->Wcm->cc_multiup
#define MultiDownCost(tty) (tty)->Wcm->cc_multidown
#define MultiLeftCost(tty) (tty)->Wcm->cc_multileft
#define MultiRightCost(tty) (tty)->Wcm->cc_multiright
#endif
#define cmat(row,col) (curY = (row), curX = (col))
#define cmplus(n) \
{ \
if ((curX += (n)) >= FrameCols && !MagicWrap) \
{ \
if (Wcm.cm_losewrap) losecursor (); \
else if (AutoWrap) curX = 0, curY++; \
else curX--; \
} \
#define cmat(tty,row,col) (curY(tty) = (row), curX(tty) = (col))
#define cmplus(tty,n) \
{ \
if ((curX (tty) += (n)) >= FrameCols (tty) && !MagicWrap (tty)) \
{ \
if ((tty)->Wcm->cm_losewrap) losecursor (tty); \
else if (AutoWrap (tty)) curX (tty) = 0, curY (tty)++; \
else curX (tty)--; \
} \
}
#define losecursor() (curX = -1, curY = -1)
#define losecursor(tty) (curX(tty) = -1, curY(tty) = -1)
extern int cost;
extern int evalcost ();
......@@ -167,10 +166,10 @@ extern int evalcost ();
extern struct tty_output *current_tty;
extern void cmcheckmagic P_ ((struct tty_output *));
extern int cmputc P_ ((int));
extern void cmcostinit ();
extern void cmcostinit P_ ((struct tty_output *tty));
extern void cmgoto P_ ((struct tty_output *, int, int));
extern void Wcm_clear ();
extern int Wcm_init ();
extern void Wcm_clear P_ ((struct tty_output *tty));
extern int Wcm_init P_ ((struct tty_output *tty));
/* arch-tag: acc1535a-7136-49d6-b22d-9bc85702251b
(do not change this comment) */
......@@ -2558,7 +2558,7 @@ extern int x_intersect_rectangles P_ ((XRectangle *, XRectangle *,
void get_tty_size P_ ((struct tty_output *, int *, int *));
void request_sigio P_ ((void));
void unrequest_sigio P_ ((void));
int tabs_safe_p P_ ((void));
int tabs_safe_p P_ ((struct tty_output *));
void init_baud_rate P_ ((void));
void init_sigio P_ ((int));
......@@ -2724,8 +2724,8 @@ extern Lisp_Object Qredisplay_dont_pause;
/* Defined in term.c */
extern void ring_bell P_ ((void));
extern void set_terminal_modes P_ ((struct tty_output *));
extern void reset_terminal_modes P_ ((struct tty_output *));
extern void set_terminal_modes P_ (());
extern void reset_terminal_modes P_ (());
extern void update_begin P_ ((struct frame *));
extern void update_end P_ ((struct frame *));
extern void set_terminal_window P_ ((int));
......
......@@ -259,10 +259,6 @@ Lisp_Object selected_frame;
struct frame *last_nonminibuf_frame;
/* Structure for info on cursor positioning. */
struct cm Wcm;
/* 1 means SIGWINCH happened when not safe. */
int delayed_size_change;
......@@ -6059,7 +6055,7 @@ change_frame_size_1 (f, newheight, newwidth, pretend, delay, safe)
newheight - FRAME_TOP_MARGIN (f), 0);
if (FRAME_TERMCAP_P (f) && !pretend)
FrameRows = newheight;
FrameRows (FRAME_TTY (f)) = newheight;
}
if (new_frame_total_cols != FRAME_TOTAL_COLS (f))
......@@ -6069,7 +6065,7 @@ change_frame_size_1 (f, newheight, newwidth, pretend, delay, safe)
set_window_width (FRAME_MINIBUF_WINDOW (f), new_frame_total_cols, 0);
if (FRAME_TERMCAP_P (f) && !pretend)
FrameCols = newwidth;
FrameCols (FRAME_TTY (f)) = newwidth;
if (WINDOWP (f->tool_bar_window))
XSETFASTINT (XWINDOW (f->tool_bar_window)->total_cols, newwidth);
......
......@@ -752,7 +752,7 @@ do_switch_frame (frame, track, for_deletion)
&& FRAME_TERMCAP_P (XFRAME (frame))
&& FRAME_TTY (XFRAME (selected_frame)) == FRAME_TTY (XFRAME (frame)))
{
XFRAME (selected_frame)->async_visible = 0;
XFRAME (selected_frame)->async_visible = 2; /* obscured */
XFRAME (frame)->async_visible = 1;
FRAME_TTY (XFRAME (frame))->top_frame = frame;
}
......
......@@ -341,13 +341,13 @@ struct frame
frame becomes visible again, it must be marked as garbaged. The
FRAME_SAMPLE_VISIBILITY macro takes care of this.
On Windows NT/9X, to avoid wasting effort updating visible frames
that are actually completely obscured by other windows on the
display, we bend the meaning of visible slightly: if greater than
1, then the frame is obscured - we still consider it to be
"visible" as seen from lisp, but we don't bother updating it. We
must take care to garbage the frame when it ceaces to be obscured
though. Note that these semantics are only used on NT/9X.
On ttys and on Windows NT/9X, to avoid wasting effort updating
visible frames that are actually completely obscured by other
windows on the display, we bend the meaning of visible slightly:
if greater than 1, then the frame is obscured - we still consider
it to be "visible" as seen from lisp, but we don't bother
updating it. We must take care to garbage the frame when it
ceaces to be obscured though.
iconified is nonzero if the frame is currently iconified.
......
......@@ -6460,7 +6460,7 @@ get_filtered_input_pending (addr, do_timers_now, filter_events)
/* If input is being read as it arrives, and we have none, there is none. */
if (*addr > 0 || (interrupt_input && ! interrupts_deferred))
return;
/* Try to read some input and see how much we get. */
gobble_input (0);
*addr = (!NILP (Vquit_flag)
......@@ -6579,7 +6579,7 @@ read_avail_input (expected)
struct input_event buf[KBD_BUFFER_SIZE];
register int i;
int nread;
for (i = 0; i < KBD_BUFFER_SIZE; i++)
EVENT_INIT (buf[i]);
......@@ -6611,8 +6611,8 @@ read_avail_input (expected)
nread = 0;
/* Try to read from each available tty, until one succeeds. */
for (tty = tty_list; tty && !nread; tty = tty->next) {
for (tty = tty_list; tty; tty = tty->next) {
/* Determine how many characters we should *try* to read. */
#ifdef FIONREAD
/* Find out how much input is available. */
......@@ -6624,6 +6624,7 @@ read_avail_input (expected)
/* ??? Is it really right to send the signal just to this process
rather than to the whole process group?
Perhaps on systems with FIONREAD Emacs is alone in its group. */
/* It appears to be the case, see narrow_foreground_group. */
if (! noninteractive)
{
if (! tty_list->next)
......@@ -6706,15 +6707,20 @@ read_avail_input (expected)
#endif /* USG or DGUX or CYGWIN */
#endif /* no FIONREAD */
if (nread > 0)
break;
} /* for each tty */
if (! nread)
if (nread <= 0)
return 0;
#endif /* not MSDOS */
#endif /* not WINDOWSNT */
/* XXX Select frame corresponding to the tty. */
/* 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);
for (i = 0; i < nread; i++)
{
......@@ -6725,8 +6731,8 @@ read_avail_input (expected)
if (meta_key != 2)
cbuf[i] &= ~0x80;
buf[i].code = cbuf[i];
buf[i].frame_or_window = selected_frame;
buf[i].code = cbuf[i];
buf[i].frame_or_window = frame;
buf[i].arg = Qnil;
}
}
......
......@@ -2952,7 +2952,6 @@ extern void child_setup_tty P_ ((int));
extern void setup_pty P_ ((int));
extern int set_window_size P_ ((int, int, int));
extern void create_process P_ ((Lisp_Object, char **, Lisp_Object));
extern int tabs_safe_p P_ ((void));
extern void init_baud_rate P_ ((void));
extern int emacs_open P_ ((const char *, int, int));
extern int emacs_close P_ ((int));
......
......@@ -249,8 +249,8 @@ int emacs_ospeed;
void croak P_ ((char *));
#ifdef AIXHFT
void hft_init ();
void hft_reset ();
void hft_init P_ ((struct tty_output *));
void hft_reset P_ ((struct tty_output *));
#endif
/* Temporary used by `sigblock' when defined in terms of signprocmask. */
......@@ -282,8 +282,12 @@ discard_tty_input ()
#else /* not VMS */
#ifdef APOLLO
{
int zero = 0;
ioctl (fileno (TTY_INPUT (CURTTY())), TIOCFLUSH, &zero);
struct tty_output *tty;
for (tty = tty_list; tty; tty = tty->next)
{
int zero = 0;
ioctl (fileno (TTY_INPUT (tty)), TIOCFLUSH, &zero);
}
}
#else /* not Apollo */
#ifdef MSDOS /* Demacs 1.1.1 91/10/16 HIRANO Satoshi */
......@@ -310,12 +314,7 @@ discard_tty_input ()
the terminal. */
void
#ifdef PROTOTYPES
stuff_char (char c)
#else
stuff_char (c)
char c;
#endif
{
if (read_socket_hook)
return;
......@@ -1074,22 +1073,23 @@ int inherited_pgroup;
group, redirect the TTY to point to our own process group. We need
to be in our own process group to receive SIGIO properly. */
void
narrow_foreground_group ()
narrow_foreground_group (struct tty_output *tty)
{
int me = getpid ();
setpgrp (0, inherited_pgroup);
/* XXX This only works on the controlling tty. */
if (inherited_pgroup != me)
EMACS_SET_TTY_PGRP (fileno (stdin), &me); /* stdin is intentional here */
EMACS_SET_TTY_PGRP (fileno (TTY_INPUT (tty)), &me);
setpgrp (0, me);
}
/* Set the tty to our original foreground group. */
void
widen_foreground_group ()
widen_foreground_group (struct tty_output *tty)
{
if (inherited_pgroup != getpid ())
EMACS_SET_TTY_PGRP (fileno (stdin), &inherited_pgroup); /* stdin is intentional here */
EMACS_SET_TTY_PGRP (fileno (TTY_INPUT (tty)), &inherited_pgroup);
setpgrp (0, inherited_pgroup);
}
......@@ -1353,7 +1353,7 @@ nil means don't delete them until `list-processes' is run. */);
#ifdef BSD_PGRPS
if (! read_socket_hook && EQ (Vwindow_system, Qnil))
narrow_foreground_group ();
narrow_foreground_group (tty_out);
#endif
#ifdef HAVE_WINDOW_SYSTEM
......@@ -1578,7 +1578,7 @@ nil means don't delete them until `list-processes' is run. */);
#endif
#ifdef AIXHFT
hft_init ();
hft_init (tty_out);
#ifdef IBMR2AIX
{
/* IBM's HFT device usually thinks a ^J should be LF/CR. We need it
......@@ -1678,12 +1678,12 @@ nil means don't delete them until `list-processes' is run. */);
At the time this is called, init_sys_modes has not been done yet. */
int
tabs_safe_p ()
tabs_safe_p (struct tty_output *tty)
{
struct emacs_tty tty;
struct emacs_tty etty;
EMACS_GET_TTY (fileno (TTY_INPUT (CURTTY())), &tty);
return EMACS_TTY_TABS_OK (&tty);
EMACS_GET_TTY (fileno (TTY_INPUT (tty)), &etty);
return EMACS_TTY_TABS_OK (&etty);
}
/* Get terminal size from system.
......@@ -1888,7 +1888,7 @@ reset_sys_modes (tty_out)
#endif