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