Commit | Line | Data |
---|---|---|
3224dac1 | 1 | -*- coding: utf-8; mode: text; -*- |
28d440ab KL |
2 | GOAL |
3 | ---- | |
4 | ||
2246281f KL |
5 | The goal of this branch is to implement support for opening multiple, |
6 | different tty devices and simultaneous X and tty frames from a single | |
7 | Emacs session. | |
28d440ab | 8 | |
7b00d185 | 9 | Some use cases: |
7b00d185 KL |
10 | Emacs is notoriously slow at startup, so most people use another |
11 | editor or emacsclient for quick editing jobs from the console. | |
12 | Unfortunately, emacsclient was very awkward to use, because it did not | |
13 | support opening a new Emacs frame on the current virtual console. | |
14 | Now, with multi-tty support, it can do that. (Emacsclient starts up | |
15 | faster than vi!) | |
16 | ||
17 | Some Gnus users (including me) run Gnus in an X frame in its own Emacs | |
18 | instance, which they typically leave running for weeks. It would be | |
19 | nice if they could connect to this instance from a remote ssh session | |
20 | and check their messages without opening a remote X frame or resorting | |
21 | to gnus-slave. | |
22 | ||
28d440ab KL |
23 | WHO IS DOING IT |
24 | --------------- | |
25 | ||
26 | I'm Károly Lőrentey. My address: lorentey@elte.hu. | |
27 | ||
2246281f | 28 | Comments, bug reports, suggestions and patches are welcome! |
28d440ab | 29 | |
6548cf00 | 30 | Retrieving the latest version of the branch: |
4f0359de KL |
31 | |
32 | tla register-archive lorentey@elte.hu--2004 http://lorentey.web.elte.hu/arch/2004/ | |
daf01701 | 33 | tla get lorentey@elte.hu--2004/emacs--multi-tty <directory> |
4f0359de | 34 | |
7b00d185 KL |
35 | (I use a recent arch development snapshot, but any of the released |
36 | versions of arch will do fine, I think.) | |
37 | ||
6ad9aaa9 KL |
38 | To update your source tree to the latest revision after the first |
39 | checkout, simply use the following command: | |
40 | ||
41 | tla replay lorentey@elte.hu--2004/emacs--multi-tty--0 | |
42 | ||
43 | If you are interested, you can find more detailed information about | |
44 | Arch on http://wiki.gnuarch.org/. It's a wonderful source control | |
45 | system, I highly recommend it. | |
46 | ||
7b00d185 KL |
47 | If you don't have arch, the branch has a homepage from which you can |
48 | download conventional patches against Emacs CVS HEAD: | |
4f0359de | 49 | |
7b00d185 | 50 | http://lorentey.web.elte.hu/project/emacs.html |
28d440ab | 51 | |
6c3d443b KL |
52 | If you want to be notified of new revisions, sign up to the |
53 | multi-tty@listbox.elte.hu mailing list by visiting the | |
54 | below homepage and following its instructions. | |
55 | ||
56 | https://listbox.elte.hu/mailman/listinfo/multi-tty | |
57 | ||
58 | Please note that the multi-tty mailing list is read-only, and is | |
59 | reserved for automatic commit messages. Discussion about the branch | |
60 | and bug reports should be sent directly to me (lorentey@elte.hu), or | |
aaaf7fe1 KL |
61 | to the emacs-devel@gnu.org mailing list. (I hope to merge my branch |
62 | into CVS HEAD reasonably soon, so I don't want to set up an elaborate | |
63 | development infrastructure for the multi-tty branch.) | |
6c3d443b | 64 | |
28d440ab KL |
65 | STATUS |
66 | ------ | |
67 | ||
2cd1371d KL |
68 | The branch is now very stable and almost full-featured. All of the |
69 | major problems have been fixed, only a few minor issues remain. (It | |
70 | still needs to be ported to Windows/Mac/DOS, though.) Both multiple | |
71 | tty device support and simultaneous X and tty frame support works | |
72 | fine. Emacsclient has been extended to support opening new tty and X | |
73 | frames. It has been changed open new Emacs frames by default. | |
74 | ||
75 | The multi-tty branch has been scheduled for inclusion in the next | |
76 | major release of Emacs (version 22). I expect the merge into the | |
77 | development trunk to occur sometime during next year (2005), after the | |
78 | merge of the Unicode branch. | |
2246281f | 79 | |
2246281f | 80 | Please let me know if you find any bugs in this branch. |
28d440ab | 81 | |
0c72d684 KL |
82 | HOW TO COMPILE AND TEST |
83 | ----------------------- | |
84 | ||
aaaf7fe1 KL |
85 | To try out the multi-tty branch, compile and run the multi-tty branch |
86 | with the following commands: | |
bc279d67 | 87 | |
2a0c7b06 | 88 | find -name "*.elc" | xargs rm # Delete leftover stuff |
bc279d67 KL |
89 | mkdir +build |
90 | cd +build | |
0c72d684 | 91 | ../configure <your favourite options> |
bc279d67 | 92 | make bootstrap |
2246281f | 93 | src/emacs -nw # You can also try without -nw |
7b00d185 | 94 | M-x server-start |
bc279d67 | 95 | |
7b00d185 KL |
96 | and then (from a shell prompt on another terminal) start emacsclient |
97 | with | |
aaaf7fe1 KL |
98 | lib-src/emacsclient /optional/file/names... |
99 | or | |
7b00d185 | 100 | lib-src/emacsclient -t /optional/file/names... |
28d440ab | 101 | |
04c3243c | 102 | You'll hopefully have two fully working, independent frames on |
7b00d185 | 103 | separate terminals. The new frame is closed automatically when you |
2a0c7b06 KL |
104 | finish editing the specified files (C-x #), but delete-frame (C-x 5 0) |
105 | also works. Of course, you can create frames on more than two tty | |
106 | devices. | |
52c2ee2a | 107 | |
7b00d185 KL |
108 | Creating new frames on the same tty with C-x 5 2 works, and they |
109 | behave the same way as in previous Emacs versions. If you exit emacs, | |
110 | all terminals should be restored to their previous states. | |
daf01701 | 111 | |
7b00d185 KL |
112 | This is work in progress, and probably full of bugs. You should |
113 | always run emacs from gdb, so that you'll have a live instance to | |
2246281f | 114 | debug if something goes wrong. Please send me your bug reports. |
04c3243c | 115 | |
bacb6689 KL |
116 | I think the best way to use the new Emacs is to have it running inside |
117 | a disconnected GNU screen session, and always use emacsclient for | |
118 | normal work. This way not a single keystroke of your work will be | |
119 | lost if the display device that you are using crashes, or the network | |
120 | connection times out, or whatever. As long as the server that runs | |
121 | your Emacs remains up, all your buffers remain exactly as they were | |
122 | before the crash, and you can continue working as if nothing had | |
123 | happened. (I had an extremely unstable X server for some time while I | |
124 | was developing these patches, and running Emacs this way has saved me | |
125 | a number of M-x recover-session invocations.) | |
126 | ||
127 | (I am thinking about introducing a --daemon option to get rid of the | |
128 | above screen dependency.) | |
129 | ||
7b00d185 | 130 | Problems: |
6548cf00 | 131 | |
7b00d185 KL |
132 | * Mac, Windows and DOS support is broken, probably doesn't |
133 | even compile -- this will be solved later. | |
134 | ||
d3c554a0 | 135 | * Only tested on my GNU/Linux box, Solaris 8 and FreeBSD. |
28d440ab KL |
136 | |
137 | NEWS | |
138 | ---- | |
139 | ||
2cd1371d | 140 | For the NEWS file: (Needs work) |
28d440ab | 141 | |
2246281f | 142 | ** Support for multiple terminal devices has been added. |
6548cf00 | 143 | |
2246281f KL |
144 | *** You can specify a terminal device (`tty' parameter) and a terminal |
145 | type (`tty-type' parameter) to `make-terminal-frame'. | |
6548cf00 | 146 | |
2246281f KL |
147 | *** You can test for the presence of multiple terminal support by |
148 | testing for the `multi-tty' feature. | |
28d440ab | 149 | |
2246281f | 150 | *** Emacsclient has been extended to support opening a new terminal |
aaaf7fe1 KL |
151 | frame. Its behaviour has been changed to open a new Emacs frame by |
152 | default. Use the -c option to get the old behavior of opening | |
153 | files in the currently selected Emacs frame. | |
e5299d8d | 154 | |
2246281f KL |
155 | *** A make-frame-on-tty function has been added to make it easier to |
156 | create frames on new terminals. | |
157 | ||
158 | *** New functions: frame-tty-name, frame-tty-type for accessing | |
159 | terminal parameters, and delete-tty for closing the terminal | |
160 | device. | |
161 | ||
162 | *** talk.el has been extended for multiple tty support. | |
163 | ||
164 | ||
165 | ** Support for simultaneous graphical and terminal frames has been | |
166 | added. | |
167 | ||
168 | *** The function `make-frame-on-display' now works during a terminal | |
169 | session, and `make-frame-on-tty' works during a graphical session. | |
170 | ||
171 | *** The `window-system' variable has been made frame-local. | |
172 | ||
173 | *** The new `initial-window-system' variable contains the | |
174 | `window-system' value for the first frame. | |
819b8f00 | 175 | |
d448e982 KL |
176 | THANKS |
177 | ------ | |
178 | ||
179 | The following is an (incomplete) list of people who have contributed | |
180 | to the project by testing, bug reports, and suggestions. Thanks! | |
181 | ||
7c10362e | 182 | ARISAWA Akihiro <ari at mbf dot ocn dot ne dot jp> |
026ad6ba | 183 | Robert J. Chassell <bob at rattlesnake dot com> |
806c1866 | 184 | Romain Francoise <romain at orebokech dot com> |
0c72d684 | 185 | Ami Fischman <ami at fischman dot org> |
35dfa9b6 | 186 | Friedrich Delgado Friedrichs <friedel at nomaden dot org> |
3de8a253 | 187 | Yoshiaki Kasahara <kasahara at nc dot kyushu-u dot ac dot jp> |
8c8d5f35 | 188 | Jurej Kubelka <Juraj dot Kubelka at email dot cz> |
4edd8a5c | 189 | Istvan Marko <mi-mtty ar kismala dot com> |
0c72d684 | 190 | Dan Nicolaescu <dann at ics dot uci dot edu> |
cd5355f9 | 191 | Gergely Nagy <algernon at debian dot org> |
aaaf7fe1 | 192 | Mark Plaksin <happy at mcplaksin dot org> |
026ad6ba | 193 | Francisco Borges <borges at let dot rug dot nl> |
d3c554a0 | 194 | Frank Ruell <stoerte at dreamwarrior dot net> |
f76e7db6 | 195 | Dan Waber <dwaber at logolalia dot com> |
9002956f | 196 | and many others. |
0c72d684 | 197 | |
d3c554a0 KL |
198 | Richard Stallman was kind enough to review an earlier version of my |
199 | patches. | |
d448e982 | 200 | |
28d440ab KL |
201 | CHANGELOG |
202 | --------- | |
203 | ||
204 | See arch logs. | |
205 | ||
7b00d185 KL |
206 | THINGS TO DO |
207 | ------------ | |
4edd8a5c | 208 | |
6ea444cf KL |
209 | ** Have a look at fatal_error_hook. |
210 | ||
7d1a6b33 KL |
211 | ** Check if we got term-setup-hook right. |
212 | ||
54021676 KL |
213 | ** make-frame does not correctly handle extra parameters in its |
214 | argument: | |
215 | ||
216 | (frame-parameter (make-frame (list (cons 'foobar 42))) 'foobar) | |
217 | => nil | |
218 | ||
219 | (This is likely an error in the CVS trunk.) | |
220 | ||
d3c554a0 KL |
221 | ** Fix set-input-mode for multi-tty. It's a truly horrible interface; |
222 | what if we'd blow it up into several separate functions (with a | |
223 | compatibility definition)? | |
224 | ||
f76e7db6 KL |
225 | ** Lisp-level stuff that needs to be updated for multi-tty: |
226 | ||
227 | - normal-erase-is-backspace-mode (simple.el) (rep. by Dan Waber) | |
228 | ||
229 | ||
cd5355f9 KL |
230 | ** The single-keyboard mode of MULTI_KBOARD is extremely confusing |
231 | sometimes; Emacs does not respond to stimuli from other keyboards. | |
232 | At least a beep or a message would be important, if the single-mode | |
233 | is still required to prevent interference. (Reported by Dan | |
026ad6ba KL |
234 | Nicolaescu.) (Update: selecting a region with the mouse enables |
235 | single_kboard under X. This is very confusing.) | |
cd5355f9 | 236 | |
2666355c KL |
237 | ** The terminal customization files in term/*.el tend to change global |
238 | parameters, which may confuse Emacs with multiple displays. Change | |
239 | them to tweak only frame-local settings, if possible. | |
240 | ||
01d81f75 KL |
241 | ** Dan Nicolaescu suggests that -nw should be added as an alias for -t |
242 | in emacsclient. Good idea. (Alas, implementing this is not | |
243 | trivial, getopt_long does not seem to support two-letter ``short'' | |
d3c554a0 | 244 | options. Patches are welcome.) :-) |
01d81f75 KL |
245 | |
246 | ** Mark Plaksin suggests that emacsclient should accept the same | |
247 | X-related command-line arguments as Emacs. Most of the X-related | |
248 | argument-handling is done in Lisp, so this should be quite easy to | |
249 | implement. | |
d448e982 | 250 | |
cd5355f9 KL |
251 | ** Gergely Nagy suggests that C-x # should only kill the current |
252 | frame, not any other emacsclient frame that may have the same file | |
253 | opened for editing. I think I agree with him. | |
254 | ||
d3c554a0 KL |
255 | ** Miles Bader suggests that C-x C-c on an emacsclient frame should |
256 | only close the frame, not exit the entire Emacs session. | |
257 | ||
0b0d3e0b | 258 | ** Make `struct display' accessible to Lisp programs. Accessor functions: |
4ca927b4 | 259 | |
0b0d3e0b | 260 | (displayp OBJECT): Returns t if OBJECT is a display. |
7b00d185 | 261 | |
4388f101 KL |
262 | (display-list): Returns list of currently active displays. |
263 | ||
0b0d3e0b KL |
264 | (selected-display): Returns the display object of the selected frame. |
265 | ||
266 | (frame-display FRAME): Returns the display object of FRAME. | |
267 | ||
268 | (display-frames DISPLAY): Returns a list of frames on DISPLAY. | |
269 | ||
270 | (display-type DISPLAY): Returns the type of DISPLAY, as a | |
271 | symbol. (See `framep'.) | |
272 | ||
273 | (display-device DISPLAY): Returns the name of the device that | |
274 | DISPLAY uses, as a string. (E.g: "/dev/pts/16", or | |
275 | ":0.0") | |
276 | ||
4388f101 KL |
277 | etc. |
278 | ||
0b0d3e0b KL |
279 | See next issue why this is necessary. |
280 | ||
2cd1371d KL |
281 | (Update: The consensus on emacs-devel seems to be to do this via |
282 | integer identifiers. That's fine by me.) | |
283 | ||
0b0d3e0b KL |
284 | ** The following needs to be supported: |
285 | ||
286 | $ emacsclient -t | |
287 | C-z | |
0b0d3e0b KL |
288 | $ emacsclient -t |
289 | (This fails now.) | |
290 | ||
291 | The cleanest way to solve this is to allow multiple displays on the | |
292 | same terminal device; each new emacsclient process should create | |
293 | its own display. As displays are currently identified by their | |
294 | device names, this is not possible until struct display becomes | |
295 | accessible as a Lisp-level object. | |
bacb6689 | 296 | |
0b0d3e0b KL |
297 | ** Very strange bug: visible-bell does not work on secondary |
298 | terminals in xterm and konsole. The screen does flicker a bit, | |
299 | but it's so quick it isn't noticable. | |
300 | ||
301 | ** Clean up the frame-local variable system. I think it's ugly and | |
302 | error-prone. But maybe I just haven't yet fully understood it. | |
303 | ||
428a555e | 304 | ** Move baud_rate to struct display. |
7b00d185 | 305 | |
7b00d185 KL |
306 | ** Implement support for starting an interactive Emacs session without |
307 | an initial frame. (The user would connect to it and open frames | |
f70dd009 | 308 | later, with emacsclient.) |
7b00d185 | 309 | |
2cd1371d KL |
310 | ** Fix Mac support (I can't do this entirely myself). Note that the |
311 | current state of Mac-specific source files in the multi-tty tree | |
312 | are not useful; before starting work on Mac support, revert to | |
313 | pristine, pre-multi-tty versions. | |
7b00d185 | 314 | |
2cd1371d KL |
315 | ** Fix W32 support (I can't do this entirely myself). Note that the |
316 | current state of W32-specific source files in the multi-tty tree | |
317 | are not useful; before starting work on W32 support, revert to | |
318 | pristine, pre-multi-tty versions. | |
7b00d185 | 319 | |
2cd1371d KL |
320 | ** Fix DOS support (I can't do this entirely myself). Note that the |
321 | current state of DOS-specific source files in the multi-tty tree | |
322 | are not useful; before starting work on DOS support, revert to | |
323 | pristine, pre-multi-tty versions. | |
7b00d185 KL |
324 | |
325 | ** Do a grep on XXX and ?? for more issues. | |
326 | ||
d3c554a0 KL |
327 | ** Understand Emacs's low-level input system (it's black magic) :-) |
328 | What exactly does interrupt_input do? I tried to disable it for | |
329 | raw secondary tty support, but it does not seem to do anything | |
330 | useful. (Update: Look again. X unconditionally enables this, maybe | |
331 | that's why raw terminal support is broken again. I really do need | |
332 | to understand input.) | |
7b00d185 | 333 | |
2246281f KL |
334 | ** Maybe standard-display-table should be display-local. |
335 | ||
6548cf00 KL |
336 | DIARY OF CHANGES |
337 | ---------------- | |
338 | ||
339 | (ex-TODO items with explanations.) | |
28d440ab | 340 | |
114a8b8c | 341 | -- Introduce a new struct for terminal devices. |
28d440ab | 342 | |
daf01701 | 343 | (Done, see struct tty_output. The list of members is not yet |
28d440ab KL |
344 | complete.) |
345 | ||
28d440ab KL |
346 | -- Change the bootstrap procedure to initialize tty_list. |
347 | ||
348 | (Done, but needs review.) | |
349 | ||
28d440ab KL |
350 | -- Change make-terminal-frame to support specifying another tty. |
351 | ||
352 | (Done, new frame parameters: `tty' and `tty-type'.) | |
353 | ||
9628b887 KL |
354 | -- Implement support for reading from multiple terminals. |
355 | ||
356 | (Done, read_avail_input tries to read from each terminal, until one | |
28d7d09f | 357 | succeeds. MULTI_KBOARD is not used. Secondary terminals don't send |
6548cf00 | 358 | SIGIO!) |
9628b887 | 359 | |
819b8f00 KL |
360 | (Update: They do, now.) |
361 | ||
daf01701 KL |
362 | (Update2: After enabling X, they don't.) |
363 | ||
9628b887 | 364 | -- other-frame should cycle through the frames on the `current' |
114a8b8c | 365 | terminal only. |
9628b887 | 366 | |
6548cf00 | 367 | (Done, by trivially modifiying next_frame and prev_frame.) |
9628b887 KL |
368 | |
369 | -- Support different terminal sizes. | |
114a8b8c | 370 | |
9628b887 KL |
371 | (Done, no problem.) |
372 | ||
373 | -- Make sure terminal resizes are handled gracefully. (Could be | |
374 | problematic.) | |
375 | ||
6548cf00 KL |
376 | (Done. We don't get automatic SIGWINCH for additional ttys, |
377 | though.) | |
9628b887 KL |
378 | |
379 | -- Extend emacsclient to automatically open a new tty when it connects | |
380 | to Emacs. | |
114a8b8c | 381 | |
9628b887 KL |
382 | (Done. It's an ugly hack, needs more work.) |
383 | ||
52c2ee2a KL |
384 | -- Redisplay must refresh the topmost frame on *all* terminals, not |
385 | just the initial terminal. | |
114a8b8c | 386 | |
52c2ee2a | 387 | (Done, but introduced an ugly redisplay problems. Ugh.) |
9628b887 | 388 | |
6548cf00 KL |
389 | -- Fix redisplay problems. |
390 | ||
52c2ee2a KL |
391 | (Done; it turned out that the entire Wcm structure must be moved |
392 | inside tty_output. Why didn't I catch this earlier?) | |
6548cf00 KL |
393 | |
394 | -- Provide a way for emacsclient to tell Emacs that the tty has been | |
395 | resized. | |
396 | ||
397 | (Done, simply forward the SIGWINCH signal.) | |
398 | ||
399 | -- Each keypress should automatically select the frame corresponding | |
400 | to the terminal that it was coming from. This means that Emacs | |
401 | must know from which terminal the last keyboard event came from. | |
6548cf00 | 402 | |
52c2ee2a KL |
403 | (Done, it was quite simple, the input event system already |
404 | supported multiple frames.) | |
6548cf00 KL |
405 | |
406 | -- Fix SIGIO issue with secondary terminals. | |
407 | ||
408 | (Done, emacsclient signals Emacs after writing to the proxy pseudo | |
52c2ee2a KL |
409 | terminal. Note that this means that multi-tty does not work with |
410 | raw ttys!) | |
28d440ab | 411 | |
0a125897 KL |
412 | (Update: This is bullshit. There is a read_input_waiting function, |
413 | extend that somehow.) | |
414 | ||
819b8f00 KL |
415 | (Update of update: The first update was not right either, extending |
416 | read_input_waiting was not necessary. Secondary ttys do seem to | |
417 | send signals on input.) | |
418 | ||
daf01701 KL |
419 | (Update^3: Not any more.) |
420 | ||
fca177d4 KL |
421 | -- Make make-terminal-frame look up the `tty' and `tty-type' frame |
422 | parameters from the currently selected terminal before the global | |
423 | default. | |
424 | ||
425 | (Done.) | |
426 | ||
427 | -- Put all cached terminal escape sequences into struct tty_output. | |
428 | Currently, they are still stored in global variables, so we don't | |
429 | really support multiple terminal types. | |
430 | ||
52c2ee2a | 431 | (Done. It was not fun.) |
fca177d4 KL |
432 | |
433 | -- Implement sane error handling after initialization. (Currently | |
6548cf00 KL |
434 | emacs exits if you specify a bad terminal type.) The helpful error |
435 | messages must still be provided when Emacs starts. | |
436 | ||
fca177d4 KL |
437 | (Done.) |
438 | ||
439 | -- Implement terminal deletion, i.e., deleting local frames, closing | |
440 | the tty device and restoring its previous state without exiting | |
441 | Emacs. | |
9628b887 | 442 | |
fca177d4 KL |
443 | (Done, but at the moment only called when an error happens during |
444 | initialization. There is a memory corruption error around this | |
daf01701 | 445 | somewhere.) (Update: now it is fully enabled.) |
fca177d4 | 446 | |
8303ba32 KL |
447 | -- Implement automatic deletion of terminals when the last frame on |
448 | that terminal is closed. | |
449 | ||
450 | (Done.) | |
451 | ||
0a125897 KL |
452 | -- Restore tty screen after closing the terminal. |
453 | ||
454 | (Done, we do the same as Emacs 21.2 for all terminals.) | |
455 | ||
456 | -- 'TERM=dumb src/emacs' does not restore the terminal state. | |
114a8b8c | 457 | |
0a125897 | 458 | (Done.) |
fca177d4 | 459 | |
b2af72d2 KL |
460 | -- C-g should work on secondary terminals. |
461 | ||
462 | (Done, but the binding is not configurable.) | |
463 | ||
464 | -- Deal with SIGHUP in Emacs and in emacsclient. (After this, the | |
465 | server-frames may be removed from server.el.) | |
466 | ||
467 | (Done, nothing to do. It seems that Emacs does not receive SIGHUP | |
daf01701 | 468 | from secondary ttys, which is actually a good thing.) (Update: I |
7b00d185 | 469 | think it would be a bad idea to remove server-frames.) |
b2af72d2 | 470 | |
daf01701 | 471 | -- Change emacsclient/server.el to support the -t argument better, |
b2af72d2 KL |
472 | i.e. automatically close the socket when the frame is closed. |
473 | ||
474 | (Seems to be working OK.) | |
475 | ||
16c290d8 | 476 | -- Fix mysterious memory corruption error with tty deletion. To |
fca177d4 KL |
477 | trigger it, try the following shell command: |
478 | ||
479 | while true; do TERM=no-such-terminal-definition emacsclient -h; done | |
480 | ||
481 | Emacs usually dumps core after a few dozen iterations. (The bug | |
3224dac1 | 482 | seems to be related to the xfreeing or bzeroing of |
9d9f1812 KL |
483 | tty_output.Wcm. Maybe there are outside references to struct Wcm? |
484 | Why were these vars collected into a struct before multi-tty | |
485 | support?) | |
fca177d4 | 486 | |
16c290d8 KL |
487 | (Done. Whew. It turned out that the problem had nothing to do |
488 | with hypothetical external references to Wcm, or any other | |
489 | tty_output component; it was simply that delete_tty closed the | |
490 | filehandles of secondary ttys twice, resulting in fclose doubly | |
3224dac1 | 491 | freeing memory. Utterly trivial matter. I love the C's memory |
16c290d8 KL |
492 | management, it puts hair on your chest.) |
493 | ||
819b8f00 | 494 | -- Support raw secondary terminals. (Note that SIGIO works only on |
3224dac1 | 495 | the controlling terminal.) Hint: extend read_input_waiting for |
819b8f00 | 496 | multiple ttys and hopefully this will be fixed. |
fca177d4 | 497 | |
819b8f00 KL |
498 | (Done, it seems to have been working already for some time. It |
499 | seems F_SETOWN does work, after all. Not sure what made it fail | |
500 | earlier, but it seems to be fixed (there were several changes | |
501 | around request_sigio, maybe one of them did it). | |
3224dac1 | 502 | read_input_waiting is only used in sys_select, don't change |
daf01701 | 503 | it.) (Update: After adding X support, it's broken again.) |
d3c554a0 | 504 | (Update^2: No it isn't.) :-) |
c1c63edb | 505 | |
819b8f00 | 506 | -- Find out why does Emacs abort when it wants to close its |
0a125897 | 507 | controlling tty. Hint: chan_process[] array. Hey, maybe |
16c290d8 KL |
508 | noninterrupt-IO would work, too? Update: no, there is no process |
509 | for stdin/out. | |
c33d2d42 | 510 | |
819b8f00 KL |
511 | (Done. Added add/delete_keyboard_wait_descriptor to |
512 | term_init/delete_tty. The hint was right, in a way.) | |
6548cf00 | 513 | |
819b8f00 | 514 | -- Issue with SIGIO: it needs to be disabled during redisplay. See if |
3224dac1 | 515 | fcntl kernel behaviour could be emulated by emacsclient. |
0a125897 | 516 | |
819b8f00 | 517 | (Done. Simply disabled the SIGIO emulation hack in emacsclient.) |
d3c554a0 | 518 | (Update: it was added back.) (Update^2: and removed again.) |
22de1e79 | 519 | |
819b8f00 | 520 | -- server.el: There are issues with saving files in buffers of closed |
16c290d8 KL |
521 | clients. Try editing a file with emacsclient -f, and (without |
522 | saving it) do a delete-frame. The frame is closed without | |
523 | question, and a surprising confirmation prompt appears in another | |
524 | frame. | |
525 | ||
819b8f00 KL |
526 | (Done. delete-frame now asks for confirmation if it still has |
527 | pending buffers, and modified buffers don't seem to be deleted.) | |
528 | ||
529 | -- emacsclient.el, server.el: Handle eval or file open errors when | |
daf01701 | 530 | doing -t. |
16c290d8 | 531 | |
819b8f00 | 532 | (Done.) |
22de1e79 | 533 | |
819b8f00 KL |
534 | -- Make parts of struct tty_output accessible from Lisp. The device |
535 | name and the type is sufficient. | |
22de1e79 | 536 | |
819b8f00 KL |
537 | (Done, see frame-tty-name and frame-tty-type.) |
538 | ||
539 | -- Export delete_tty to the Lisp environment, for emacsclient. | |
22de1e79 | 540 | |
819b8f00 KL |
541 | (Done, see delete-tty.) |
542 | ||
daf01701 KL |
543 | -- Get rid of the accessor macros in termchar.h, or define macros for |
544 | all members. | |
545 | ||
546 | (Done.) | |
547 | ||
548 | -- Move device-specific parameters (like costs) commonly used by | |
549 | device backends to a common, device-dependent structure. | |
550 | ||
551 | (Done. See struct display_method in termhooks.h.) | |
552 | ||
553 | -- Fix X support. | |
554 | ||
555 | (Done. Well, it seems to be working.) | |
556 | ||
557 | -- Allow simultaneous X and tty frames. (Handling input could be | |
558 | tricky. Or maybe not.) | |
559 | ||
560 | (Done. Allowed, that is. It is currently extremely unstable, to | |
561 | the point of being unusable. The rif variable causes constant | |
562 | core dumps. Handling input is indeed tricky.) | |
819b8f00 | 563 | |
7b00d185 | 564 | -- Rewrite multi-tty input in terms of MULTI_KBOARD. |
28d440ab | 565 | |
7b00d185 KL |
566 | (Done. In fact, there was no need to rewrite anything, I just |
567 | added a kboard member to tty_display_info, and initialized the | |
568 | frame's kboard from there.) | |
819b8f00 | 569 | |
fa971ac3 KL |
570 | -- Fix rif issue with X-tty combo sessions. IMHO the best thing to do |
571 | is to get rid of that global variable (and use the value value in | |
572 | display_method, which is guaranteed to be correct). | |
573 | ||
574 | (Done, did exactly that. Core dumps during combo sessions became | |
575 | much rarer. In fact, I have not yet met a single one.) | |
576 | ||
17086732 KL |
577 | -- Add multi-tty support to talk.el. |
578 | ||
579 | (Done.) | |
580 | ||
428a555e KL |
581 | -- Clean up the source of emacsclient. It is a mess. |
582 | ||
583 | (Done, eliminated stupid proxy-pty kludge.) | |
584 | ||
585 | -- Fix faces on tty frames during X-tty combo sessions. There is an | |
586 | init_frame_faces call in init_sys_modes, see if there is a problem | |
587 | with it. | |
588 | ||
589 | (Done, there was a stupid mistake in | |
590 | Ftty_supports_face_attributes_p. Colors are broken, though.) | |
591 | ||
592 | -- C-x 5 2, C-x 5 o, C-x 5 0 on an emacsclient frame unexpectedly | |
593 | exits emacsclient. This is a result of trying to be clever with | |
594 | delete-frame-functions. | |
595 | ||
596 | (Fixed, added delete-tty-after-functions, and changed server.el to | |
597 | use it.) | |
598 | ||
599 | -- Something with (maybe) multi-keyboard support broke function keys | |
600 | and arrows on ttys during X+tty combo sessions. Debug this. | |
601 | ||
602 | (I can't reproduce it, maybe the terminal type was wrong.) | |
603 | ||
604 | -- Fix input from raw ttys (again). | |
605 | ||
606 | (Now it seems to work all right.) | |
607 | ||
608 | -- During an X-tty combo session, a (message "Hello") from a tty frame | |
609 | goes to the X frame. Fix this. | |
610 | ||
611 | (Done. There was a safeguard against writing to the initial | |
612 | terminal frame during bootstrap which prevented echo_area_display | |
613 | from working correctly on a tty frame during a combo session.) | |
614 | ||
114a8b8c | 615 | -- If there are no frames on its controlling terminal, Emacs should |
d3c554a0 | 616 | exit if the user presses C-c there. |
114a8b8c KL |
617 | |
618 | (Done, as far as possible. See the SIGTERM comment in | |
619 | interrupt_signal on why this seems to be impossible to solve this | |
620 | in general.) | |
621 | ||
622 | -- During an X session, Emacs seems to read from stdin. Also, Emacs | |
623 | fails to start without a controlling tty. | |
624 | ||
625 | (Fixed by replacing the troublesome termcap display with a dummy | |
626 | bootstrap display during bootstrap. | |
627 | ||
628 | -- Do tty output through struct display, like graphical display | |
629 | backends. | |
630 | ||
631 | (Done.) | |
632 | ||
633 | -- Define an output_initial value for output_method for the initial | |
634 | frame that is dumped with Emacs. Checking for this frame (e.g. in | |
635 | cmd_error_internal) is ugly. | |
636 | ||
637 | (Done, broking interactive temacs.) | |
638 | ||
639 | -- The command `emacsclient -t -e '(delete-frame)'' fails to exit. | |
640 | ||
641 | (Fixed.) | |
642 | ||
4ca927b4 KL |
643 | -- frame-creation-function should always create a frame that is on the |
644 | same display as the selected frame. Maybe frame-creation-function | |
645 | should simply be removed and make-frame changed to do the right | |
646 | thing. | |
647 | ||
648 | (Done, with a nice hack. frame-creation-function is now frame-local.) | |
649 | ||
650 | -- Fix C-g on raw ttys. | |
651 | ||
652 | (Done. I disabled the interrupt/quit keys on all secondary | |
653 | terminals, so Emacs sees C-g as normal input. This looks like an | |
654 | overkill, because emacsclient has extra code to pass SIGINT to | |
655 | Emacs, so C-g should remain the interrupt/quit key on emacsclient | |
656 | frames. See the next entry why implementing this distinction would | |
657 | be a bad idea.) | |
658 | ||
659 | -- Make sure C-g goes to the right frame with ttys. This is hard, as | |
660 | SIGINT doesn't have a tty parameter. :-( | |
661 | ||
662 | (Done, the previous change fixes this as a pleasant side effect.) | |
663 | ||
c0707982 KL |
664 | -- I have seen a case when Emacs with multiple ttys fell into a loop |
665 | eating 100% of CPU time. Strace showed this loop: | |
666 | ||
667 | getpid() = 30284 | |
668 | kill(30284, SIGIO) = 0 | |
669 | --- SIGIO (I/O possible) @ 0 (0) --- | |
670 | ioctl(6, FIONREAD, [0]) = -1 EIO (Input/output error) | |
671 | ioctl(5, FIONREAD, [0]) = -1 EIO (Input/output error) | |
672 | ioctl(0, FIONREAD, [0]) = 0 | |
673 | sigreturn() = ? (mask now []) | |
674 | gettimeofday({1072842297, 747760}, NULL) = 0 | |
675 | gettimeofday({1072842297, 747806}, NULL) = 0 | |
676 | select(9, [0 3 5 6], NULL, NULL, {0, 0}) = 2 (in [5 6], left {0, 0}) | |
677 | select(9, [0 3 5 6], NULL, NULL, {0, 0}) = 2 (in [5 6], left {0, 0}) | |
678 | gettimeofday({1072842297, 748245}, NULL) = 0 | |
679 | ||
680 | I have seen something similar with a single X frame, but have not | |
681 | been able to reproduce it for debugging. | |
682 | ||
683 | Update: This may have been caused by checking for nread != 0 | |
684 | instead of nread > 0 after calling read_socket_hook in | |
685 | read_avail_input. | |
686 | ||
687 | (Fixed. This was caused by unconditionally including stdin in | |
688 | input_wait_mask in init_process. The select call in | |
689 | wait_reading_process_input always returned immediately, indicating | |
690 | that there is pending input from stdin, which nobody read. | |
691 | ||
692 | Note that the above strace output seems to be an unrelated but | |
693 | similar bug. I think that is now fixed.) | |
4ca927b4 | 694 | |
2246281f KL |
695 | -- Exiting Emacs while there are emacsclient frames doesn't restore the |
696 | ttys to their default states. | |
697 | ||
698 | (This seems to be fixed by some previous change.) | |
699 | ||
700 | -- Allow opening an X session after -nw. | |
701 | ||
702 | (Done.) | |
703 | ||
d448e982 KL |
704 | -- Fix color handling during tty+X combo sessions. (It seems that tty |
705 | sessions automatically convert the face colors to terminal colors | |
706 | when the face is loaded. This conversion must happen instead on | |
707 | the fly in write_glyphs, which might be problematic, as color | |
708 | approximation is currently done in lisp (term/tty-colors.el).) | |
709 | (Update: hm, colors seem to work fine if I start emacs with -nw and | |
710 | then create an X frame. Maybe it's just a small buglet somewhere.) | |
711 | ||
712 | (Seems to be fixed. The problem was in startup.el, it did not | |
713 | initialize tty colors when the initial window system was | |
714 | graphical.) | |
2246281f | 715 | |
2441679b KL |
716 | -- emacs -nw --eval '(y-or-n-p "Foobar")' segfaults. (Reported by |
717 | Romain Francoise) | |
718 | ||
719 | (Fixed, there was a keyboard initialization problem.) | |
720 | ||
3bbdbec9 KL |
721 | -- Fix interactive use of temacs. There are face-related SEGVs, most |
722 | likely because of changes in realize_default_face, realize_face. | |
723 | ||
724 | (Fixed.) | |
725 | ||
bacb6689 KL |
726 | -- Don't exit Emacs when the last X connection fails during a |
727 | multi-display session. | |
728 | ||
729 | (Fixed.) | |
730 | ||
0c72d684 KL |
731 | -- Dan Nicolaescu noticed that starting emacsclient on the same |
732 | terminal device that is the controlling tty of the Emacs process | |
733 | gives unexpected results. | |
734 | ||
735 | (Fixed.) | |
736 | ||
4edd8a5c KL |
737 | -- Istvan Marko reported that Emacs hang on ttys if it was started |
738 | from a shell script. | |
739 | ||
740 | (Fixed. There was a bug in the multi-tty version of | |
741 | narrow_foreground_group. tcsetpgrp blocks if it is called from a | |
742 | process that is not in the same process group as the tty.) | |
743 | ||
2fc0cf2a KL |
744 | -- emacsclient -t from an Emacs term buffer does not work, complains |
745 | about face problems. This can even lock up Emacs (if the recursive | |
746 | frame sets single_kboard). Update: the face problems are caused by | |
747 | bugs in term.el, not in multi-tty. The lockup is caused by | |
d3c554a0 | 748 | single_kboard mode, and is not easily resolvable. The best thing to |
2fc0cf2a KL |
749 | do is to simply refuse to create a tty frame of type `eterm'. |
750 | ||
751 | (Fixed, changed emacsclient to check for TERM=eterm. The face | |
752 | complaints seem to be caused by bugs in term.el; they are not | |
753 | related to multi-tty.) | |
754 | ||
0b0d3e0b KL |
755 | -- Find out the best way to support suspending Emacs with multiple |
756 | ttys. My guess: disable it on the controlling tty, but from other | |
757 | ttys pass it on to emacsclient somehow. (It is (I hope) trivial to | |
758 | extend emacsclient to handle suspend/resume. A `kill -STOP' almost | |
759 | works right now.) | |
760 | ||
761 | (Done. I needed to play with signal handling and the server | |
762 | protocol a bit to make emacsclient behave as a normal UNIX program | |
763 | wrt foreground/background process groups.) | |
764 | ||
eb1f46c9 KL |
765 | -- There is a flicker during the startup of `emacs -nw'; it's as if |
766 | the terminal is initialized, reset and then initialialized again. | |
767 | Debug this. (Hint: narrow_foreground_group is called twice during | |
768 | startup.) | |
769 | ||
770 | (This is gone.) | |
771 | ||
026ad6ba KL |
772 | -- Robert Chassell has found serious copy-paste bugs with the |
773 | multi-tty branch. There seem to be redisplay bugs while copying | |
774 | from X to a terminal frame. Copying accented characters do not | |
775 | work for me. | |
776 | ||
777 | (Patch-124 should fix this, by changing the interprogram-*-function | |
778 | variables to be frame-local, as suggested by Mark Plaksin | |
779 | (thanks!). I think that the redisplay bugs are in fact not bugs, | |
780 | but delays caused by single_kboard --> perhaps MULTI_KBOARD should | |
781 | be removed.) | |
782 | ||
2cd1371d KL |
783 | -- frame-creation-function was removed, which might be a bad idea. |
784 | Think up a compatible solution. | |
785 | ||
786 | (It was an internal interface that may be changed when necessary.) | |
787 | ||
788 | -- Change Lisp code not to (getenv "TERM"); use the `tty-type' frame | |
789 | parameter or the frame-tty-type function instead. (M-x tags-search | |
790 | "TERM" helps with this.) Update: Actually, all getenv invocations | |
791 | should be checked for multi-tty compatibility, and an interface | |
792 | must be implemented to get the remote client's environment. | |
793 | ||
794 | (Done. Only getenv calls in lisp/term/*.el were changed; other | |
795 | calls should be mostly left as they are.) | |
796 | ||
797 | -- Add an elaborate mechanism for display-local variables. (There are | |
798 | already a few of these; search for `terminal-local' in the Elisp | |
799 | manual.) | |
800 | ||
801 | (Not needed. Display-local variables could be emulated by | |
802 | frame-local variables.) | |
026ad6ba | 803 | |
d4d89d37 KL |
804 | -- Emacs assumes that all terminal frames have the same locale |
805 | settings as Emacs itself. This may lead to bogus results in a | |
806 | multi-locale setup. (E.g., while logging in from a remote client | |
807 | with a different locale.) | |
808 | (Update after new bugreport by Friedrich Delgado Friedrichs: | |
809 | (at least) the structs terminal_coding and keyboard_coding in | |
810 | coding.c must be moved to struct display, and the Lisp interface | |
811 | [set-]keyboard-coding-system must be adapted for the change.) | |
812 | ||
813 | (Fixed. Emacs now uses the locale settings as seen by the | |
814 | emacsclient process for server tty frames.) | |
0b0d3e0b | 815 | |
28d440ab | 816 | ;;; arch-tag: 8da1619e-2e79-41a8-9ac9-a0485daad17d |