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