comparison README.multi-tty @ 53232:22aaf1e5fbe6

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
author Karoly Lorentey <lorentey@elte.hu>
date Sat, 27 Dec 2003 01:12:57 +0000
parents 33c3c7c16e13
children fe9b37bee5f7
comparison
equal deleted inserted replaced
53231:e0c359b85b58 53232:22aaf1e5fbe6
11 11
12 I'm Károly Lőrentey. My address: lorentey@elte.hu. 12 I'm Károly Lőrentey. My address: lorentey@elte.hu.
13 13
14 Patches or suggestions are welcome! 14 Patches or suggestions are welcome!
15 15
16 Retrieving the branch: 16 Retrieving the latest version of the branch:
17 17
18 tla register-archive lorentey@elte.hu--2004 http://lorentey.web.elte.hu/arch/2004/ 18 tla register-archive lorentey@elte.hu--2004 http://lorentey.web.elte.hu/arch/2004/
19 tla get lorentey@elte.hu--2004/emacs--multi-tty--0 <directory> 19 tla get lorentey@elte.hu--2004/emacs--multi-tty--0 <directory>
20 20
21 (I use tla 1.1.) 21 (I use tla 1.1.)
22 22
23 23
24 STATUS 24 STATUS
25 ------ 25 ------
26 26
27 We can create frames on new tty devices, but there are problems with 27 Basic support is there; there are some rough edges, but it already
28 redisplay. Input is read from all terminals (NOT via MULTIKBOARD!). 28 seems to be usable. Input is read from all terminals (NOT via
29 At the moment, the type of the new terminals must be the same as the 29 MULTIKBOARD!). At the moment, the type of the new terminals must be
30 initial terminal. Emacsclient is extended to support opening a new 30 the same as the initial terminal. Emacsclient was extended to support
31 terminal frame. 31 opening a new terminal frame.
32 32
33 To try it out, start up the emacs server (M-x server-start), and then 33 To try it out, start up the emacs server (M-x server-start), and then
34 start emacsclient with 34 (from a shell prompt on another terminal) start emacsclient with
35 35
36 emacsclient -h 36 emacsclient -h
37 37
38 If you exit emacs, both terminals are restored to their previous 38 You'll have two fully working frames on separate terminals. If you
39 exit emacs, both terminals should be restored to their previous
39 states. 40 states.
40 41
41 X, Mac, Windows and DOS support is broken. 42 X, Mac, Windows and DOS support is broken at the moment.
43
44 Tested under GNU/Linux only.
42 45
43 NEWS 46 NEWS
44 ---- 47 ----
45 48
46 For the NEWS file: 49 For the NEWS file:
47 50
48 ** Support for multiple terminal devices has been added. You can 51 ** Support for multiple terminal devices has been added. You can
49 specify a terminal device (`tty' parameter) and a terminal type 52 specify a terminal device (`tty' parameter) and a terminal type
50 (`tty-type' parameter) to `make-terminal-frame'. 53 (`tty-type' parameter) to `make-terminal-frame'. `tty' must be a
54 terminal device created by the new emacsclient, or there will be
55 problems with terminal input and window resizes. (The kernel
56 notifies processes about pending input or terminal resizes only on
57 the controlling terminal, so we need emacsclient to sit on the real
58 terminal device, create SIGIO signals upon terminal input, and
59 forward SIGWINCH signals to us.)
60
61 You can test for the presence of multiple terminal support by
62 testing for the `multi-tty' feature.
63
64 ** A make-frame-on-tty function has been added to make it easier to
65 create frames on new terminals.
51 66
52 ** Emacsclient has been extended to support opening a new terminal 67 ** Emacsclient has been extended to support opening a new terminal
53 frame. 68 frame.
54 69
55 CHANGELOG 70 CHANGELOG
56 --------- 71 ---------
57 72
58 See arch logs. 73 See arch logs.
59 74
60 75
61 THINGS THAT ARE DONE 76 DIARY OF CHANGES
62 -------------------- 77 ----------------
78
79 (ex-TODO items with explanations.)
63 80
64 -- Introduce a new abstraction for terminal devices. 81 -- Introduce a new abstraction for terminal devices.
65 82
66 (Done, see struct tty_output. The abstraction is not yet 83 (Done, see struct tty_output. The abstraction is not yet
67 complete.) 84 complete.)
78 95
79 96
80 -- Implement support for reading from multiple terminals. 97 -- Implement support for reading from multiple terminals.
81 98
82 (Done, read_avail_input tries to read from each terminal, until one 99 (Done, read_avail_input tries to read from each terminal, until one
83 succeeds.) 100 succeeds. MULTIKBOARD is not used. Secondary terminals don't send
101 SIGIO!)
84 102
85 -- other-frame should cycle through the frames on the `current' 103 -- other-frame should cycle through the frames on the `current'
86 terminal. 104 terminal only.
87 105
88 (Done. A little fragile, but seems to work.) 106 (Done, by trivially modifiying next_frame and prev_frame.)
89 107
90 -- Support different terminal sizes. 108 -- Support different terminal sizes.
91 109
92 (Done, no problem.) 110 (Done, no problem.)
93 111
94 -- Make sure terminal resizes are handled gracefully. (Could be 112 -- Make sure terminal resizes are handled gracefully. (Could be
95 problematic.) 113 problematic.)
96 114
97 (Done. We don't get SIGWINCH for additional ttys, though.) 115 (Done. We don't get automatic SIGWINCH for additional ttys,
116 though.)
98 117
99 -- Extend emacsclient to automatically open a new tty when it connects 118 -- Extend emacsclient to automatically open a new tty when it connects
100 to Emacs. 119 to Emacs.
101 120
102 (Done. It's an ugly hack, needs more work.) 121 (Done. It's an ugly hack, needs more work.)
104 -- Redisplay must refresh the topmost frame on all terminals, not just 123 -- Redisplay must refresh the topmost frame on all terminals, not just
105 the initial terminal. 124 the initial terminal.
106 125
107 (Done, but introduced ugly redisplay problems. Ugh.) 126 (Done, but introduced ugly redisplay problems. Ugh.)
108 127
128 -- Fix redisplay problems.
129
130 (Done, it turned out that the entire Wcm structure must be moved
131 inside tty_output. Why was it so hard for me to find this out?)
132
133 -- Provide a way for emacsclient to tell Emacs that the tty has been
134 resized.
135
136 (Done, simply forward the SIGWINCH signal.)
137
138 -- Each keypress should automatically select the frame corresponding
139 to the terminal that it was coming from. This means that Emacs
140 must know from which terminal the last keyboard event came from.
141 (Multikeyboard support may help with this.)
142
143 (Done, it was quite simple.)
144
145 -- Fix SIGIO issue with secondary terminals.
146
147 (Done, emacsclient signals Emacs after writing to the proxy pseudo
148 terminal. This means that multi-tty does not work with raw ttys!)
109 149
110 THINGS TO DO 150 THINGS TO DO
111 ------------ 151 ------------
112 152
113 ** Fix redisplay problems. 153 ** Implement sane error handling after initialization. (Currently
154 emacs exits if you specify a bad terminal type.) The helpful error
155 messages must still be provided when Emacs starts.
156
157 ** C-g should work on secondary terminals.
114 158
115 ** Make make-terminal-frame look up the tty and tty-type parameters 159 ** Make make-terminal-frame look up the tty and tty-type parameters
116 from the currently selected terminal before the global default. 160 from the currently selected terminal before the global default.
117 161
118 ** Move optimalization parameters (costs) from union output_data to 162 ** Move optimalization parameters (costs) from union output_data to
119 struct frame. 163 a backend-neutral per-device structure.
120 164
121 ** Provide a way for emacsclient to tell Emacs that the tty has been 165 ** Implement terminal deletion, i.e., deleting local frames, closing
122 resized. 166 the tty device and restoring its previous state without exiting
123 167 Emacs. This should be exported to the Lisp environment.
124 ** Implement terminal deletion, i.e., closing the tty device and 168
125 restoring its previous state without exiting Emacs. This should be 169 ** Implement automatic deletion of terminals when the last frame on
126 exported to the Lisp interpreter.
127
128 ** Implement automatic deletion of terminals, when the last frame on
129 that terminal is closed. 170 that terminal is closed.
130 171
131 ** Put all cached terminal escape sequences into struct tty_output. 172 ** Put all cached terminal escape sequences into struct tty_output.
132 Currently, they are still stored in global variables, so we don't 173 Currently, they are still stored in global variables, so we don't
133 really support multiple terminal types. 174 really support multiple terminal types.
134 175
135 176 ** Make parts of struct tty_output accessible from Lisp. The device
136 ** Each keypress should automatically select the frame corresponding 177 name and the type is sufficient.
137 to the terminal that it was coming from. This means that Emacs
138 must know from which terminal the last keyboard event came from.
139 (Multikeyboard support may help with this.)
140
141 ** Make struct tty_output available from Lisp.
142 178
143 ** Implement support for starting an interactive Emacs session without 179 ** Implement support for starting an interactive Emacs session without
144 an initial frame. (The user would connect to it and open frames 180 an initial frame. (The user would connect to it and open frames
145 later, with emacsclient.) Not necessary a good idea. 181 later, with emacsclient.) Not necessary a good idea.
146 182
183 ** Support raw secondary terminals. (This one is tricky, SIGIO works
184 only on the controlling terminal.)
185
186 ** What does interrupt_input do? I tried to disable it for raw
187 secondary tty support, but it seems not to do anything useful.
188
147 ** Fix X support. 189 ** Fix X support.
148 190
191 ** Do tty output through term_hooks, too.
192
149 ** Allow simultaneous X and tty frames. 193 ** Allow simultaneous X and tty frames.
150 194
151 ** Fix Mac support (I can't do this myself). 195 ** Fix Mac support (I can't do this myself).
152 196
153 ** Fix W32 support (I can't do this myself). 197 ** Fix W32 support (I can't do this myself).