Merged in changes from CVS trunk
[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
026ad6ba 167Robert J. Chassell <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>
cd5355f9 172Gergely Nagy <algernon at debian dot org>
aaaf7fe1 173Mark Plaksin <happy at mcplaksin dot org>
026ad6ba 174Francisco Borges <borges at let dot rug dot nl>
0c72d684
KL
175
176Richard Stallman was kind enough to review my patches.
d448e982 177
28d440ab
KL
178CHANGELOG
179---------
180
181See arch logs.
182
7b00d185
KL
183THINGS TO DO
184------------
4edd8a5c 185
4388f101
KL
186** Emacs assumes that all terminal frames have the same locale
187 settings as Emacs itself. This may lead to bogus results in a
188 multi-locale setup. (E.g., while logging in from a remote client
189 with a different locale.)
190
cd5355f9
KL
191** The single-keyboard mode of MULTI_KBOARD is extremely confusing
192 sometimes; Emacs does not respond to stimuli from other keyboards.
193 At least a beep or a message would be important, if the single-mode
194 is still required to prevent interference. (Reported by Dan
026ad6ba
KL
195 Nicolaescu.) (Update: selecting a region with the mouse enables
196 single_kboard under X. This is very confusing.)
cd5355f9 197
2666355c
KL
198** Change Lisp code not to (getenv "TERM"); use the `tty-type' frame
199 parameter or the frame-tty-type function instead.
200 (M-x tags-search "TERM" helps with this.)
201
202** The terminal customization files in term/*.el tend to change global
203 parameters, which may confuse Emacs with multiple displays. Change
204 them to tweak only frame-local settings, if possible.
205
01d81f75
KL
206** Dan Nicolaescu suggests that -nw should be added as an alias for -t
207 in emacsclient. Good idea. (Alas, implementing this is not
208 trivial, getopt_long does not seem to support two-letter ``short''
209 options.)
210
211** Mark Plaksin suggests that emacsclient should accept the same
212 X-related command-line arguments as Emacs. Most of the X-related
213 argument-handling is done in Lisp, so this should be quite easy to
214 implement.
d448e982 215
cd5355f9
KL
216** Gergely Nagy suggests that C-x # should only kill the current
217 frame, not any other emacsclient frame that may have the same file
218 opened for editing. I think I agree with him.
219
0b0d3e0b 220** Make `struct display' accessible to Lisp programs. Accessor functions:
4ca927b4 221
0b0d3e0b 222 (displayp OBJECT): Returns t if OBJECT is a display.
7b00d185 223
4388f101
KL
224 (display-list): Returns list of currently active displays.
225
0b0d3e0b
KL
226 (selected-display): Returns the display object of the selected frame.
227
228 (frame-display FRAME): Returns the display object of FRAME.
229
230 (display-frames DISPLAY): Returns a list of frames on DISPLAY.
231
232 (display-type DISPLAY): Returns the type of DISPLAY, as a
233 symbol. (See `framep'.)
234
235 (display-device DISPLAY): Returns the name of the device that
236 DISPLAY uses, as a string. (E.g: "/dev/pts/16", or
237 ":0.0")
238
4388f101
KL
239 etc.
240
0b0d3e0b
KL
241 See next issue why this is necessary.
242
243** The following needs to be supported:
244
245 $ emacsclient -t
246 C-z
247 $ bg
248 $ emacsclient -t
249 (This fails now.)
250
251 The cleanest way to solve this is to allow multiple displays on the
252 same terminal device; each new emacsclient process should create
253 its own display. As displays are currently identified by their
254 device names, this is not possible until struct display becomes
255 accessible as a Lisp-level object.
bacb6689
KL
256
257** Add an elaborate mechanism for display-local variables. (There are
258 already a few of these; search for `terminal-local' in the Elisp
259 manual.)
260
0b0d3e0b
KL
261** Very strange bug: visible-bell does not work on secondary
262 terminals in xterm and konsole. The screen does flicker a bit,
263 but it's so quick it isn't noticable.
264
265** Clean up the frame-local variable system. I think it's ugly and
266 error-prone. But maybe I just haven't yet fully understood it.
267
428a555e 268** Move baud_rate to struct display.
7b00d185 269
7b00d185
KL
270** Implement support for starting an interactive Emacs session without
271 an initial frame. (The user would connect to it and open frames
f70dd009 272 later, with emacsclient.)
7b00d185 273
3224dac1
KL
274** Fix Mac support (I can't do this myself). Note that the current
275 state of Mac-specific source files in the multi-tty tree are not
276 useful; before starting work on Mac support, revert to pristine,
277 pre-multi-tty versions.
7b00d185 278
3224dac1
KL
279** Fix W32 support (I can't do this myself). Note that the current
280 state of W32-specific source files in the multi-tty tree are not
281 useful; before starting work on W32 support, revert to pristine,
282 pre-multi-tty versions.
7b00d185 283
3224dac1
KL
284** Fix DOS support (I can't do this myself). Note that the current
285 state of DOS-specific source files in the multi-tty tree are not
286 useful; before starting work on DOS support, revert to pristine,
287 pre-multi-tty versions.
7b00d185
KL
288
289** Do a grep on XXX and ?? for more issues.
290
291** Understand Emacs's low-level input system (it seems complicated) :-)
428a555e 292 What does interrupt_input do? I tried to disable it for raw
7b00d185
KL
293 secondary tty support, but it does not seem to do anything useful.
294 (Update: Look again. X unconditionally enables this, maybe that's
295 why raw terminal support is broken again. I really do need to
296 understand input.)
297
2246281f
KL
298** Maybe standard-display-table should be display-local.
299
6548cf00
KL
300DIARY OF CHANGES
301----------------
302
303(ex-TODO items with explanations.)
28d440ab 304
114a8b8c 305-- Introduce a new struct for terminal devices.
28d440ab 306
daf01701 307 (Done, see struct tty_output. The list of members is not yet
28d440ab
KL
308 complete.)
309
28d440ab
KL
310-- Change the bootstrap procedure to initialize tty_list.
311
312 (Done, but needs review.)
313
28d440ab
KL
314-- Change make-terminal-frame to support specifying another tty.
315
316 (Done, new frame parameters: `tty' and `tty-type'.)
317
9628b887
KL
318-- Implement support for reading from multiple terminals.
319
320 (Done, read_avail_input tries to read from each terminal, until one
28d7d09f 321 succeeds. MULTI_KBOARD is not used. Secondary terminals don't send
6548cf00 322 SIGIO!)
9628b887 323
819b8f00
KL
324 (Update: They do, now.)
325
daf01701
KL
326 (Update2: After enabling X, they don't.)
327
9628b887 328-- other-frame should cycle through the frames on the `current'
114a8b8c 329 terminal only.
9628b887 330
6548cf00 331 (Done, by trivially modifiying next_frame and prev_frame.)
9628b887
KL
332
333-- Support different terminal sizes.
114a8b8c 334
9628b887
KL
335 (Done, no problem.)
336
337-- Make sure terminal resizes are handled gracefully. (Could be
338 problematic.)
339
6548cf00
KL
340 (Done. We don't get automatic SIGWINCH for additional ttys,
341 though.)
9628b887
KL
342
343-- Extend emacsclient to automatically open a new tty when it connects
344 to Emacs.
114a8b8c 345
9628b887
KL
346 (Done. It's an ugly hack, needs more work.)
347
52c2ee2a
KL
348-- Redisplay must refresh the topmost frame on *all* terminals, not
349 just the initial terminal.
114a8b8c 350
52c2ee2a 351 (Done, but introduced an ugly redisplay problems. Ugh.)
9628b887 352
6548cf00
KL
353-- Fix redisplay problems.
354
52c2ee2a
KL
355 (Done; it turned out that the entire Wcm structure must be moved
356 inside tty_output. Why didn't I catch this earlier?)
6548cf00
KL
357
358-- Provide a way for emacsclient to tell Emacs that the tty has been
359 resized.
360
361 (Done, simply forward the SIGWINCH signal.)
362
363-- Each keypress should automatically select the frame corresponding
364 to the terminal that it was coming from. This means that Emacs
365 must know from which terminal the last keyboard event came from.
6548cf00 366
52c2ee2a
KL
367 (Done, it was quite simple, the input event system already
368 supported multiple frames.)
6548cf00
KL
369
370-- Fix SIGIO issue with secondary terminals.
371
372 (Done, emacsclient signals Emacs after writing to the proxy pseudo
52c2ee2a
KL
373 terminal. Note that this means that multi-tty does not work with
374 raw ttys!)
28d440ab 375
0a125897
KL
376 (Update: This is bullshit. There is a read_input_waiting function,
377 extend that somehow.)
378
819b8f00
KL
379 (Update of update: The first update was not right either, extending
380 read_input_waiting was not necessary. Secondary ttys do seem to
381 send signals on input.)
382
daf01701
KL
383 (Update^3: Not any more.)
384
fca177d4
KL
385-- Make make-terminal-frame look up the `tty' and `tty-type' frame
386 parameters from the currently selected terminal before the global
387 default.
388
389 (Done.)
390
391-- Put all cached terminal escape sequences into struct tty_output.
392 Currently, they are still stored in global variables, so we don't
393 really support multiple terminal types.
394
52c2ee2a 395 (Done. It was not fun.)
fca177d4
KL
396
397-- Implement sane error handling after initialization. (Currently
6548cf00
KL
398 emacs exits if you specify a bad terminal type.) The helpful error
399 messages must still be provided when Emacs starts.
400
fca177d4
KL
401 (Done.)
402
403-- Implement terminal deletion, i.e., deleting local frames, closing
404 the tty device and restoring its previous state without exiting
405 Emacs.
9628b887 406
fca177d4
KL
407 (Done, but at the moment only called when an error happens during
408 initialization. There is a memory corruption error around this
daf01701 409 somewhere.) (Update: now it is fully enabled.)
fca177d4 410
8303ba32
KL
411-- Implement automatic deletion of terminals when the last frame on
412 that terminal is closed.
413
414 (Done.)
415
0a125897
KL
416-- Restore tty screen after closing the terminal.
417
418 (Done, we do the same as Emacs 21.2 for all terminals.)
419
420-- 'TERM=dumb src/emacs' does not restore the terminal state.
114a8b8c 421
0a125897 422 (Done.)
fca177d4 423
b2af72d2
KL
424-- C-g should work on secondary terminals.
425
426 (Done, but the binding is not configurable.)
427
428-- Deal with SIGHUP in Emacs and in emacsclient. (After this, the
429 server-frames may be removed from server.el.)
430
431 (Done, nothing to do. It seems that Emacs does not receive SIGHUP
daf01701 432 from secondary ttys, which is actually a good thing.) (Update: I
7b00d185 433 think it would be a bad idea to remove server-frames.)
b2af72d2 434
daf01701 435-- Change emacsclient/server.el to support the -t argument better,
b2af72d2
KL
436 i.e. automatically close the socket when the frame is closed.
437
438 (Seems to be working OK.)
439
16c290d8 440-- Fix mysterious memory corruption error with tty deletion. To
fca177d4
KL
441 trigger it, try the following shell command:
442
443 while true; do TERM=no-such-terminal-definition emacsclient -h; done
444
445 Emacs usually dumps core after a few dozen iterations. (The bug
3224dac1 446 seems to be related to the xfreeing or bzeroing of
9d9f1812
KL
447 tty_output.Wcm. Maybe there are outside references to struct Wcm?
448 Why were these vars collected into a struct before multi-tty
449 support?)
fca177d4 450
16c290d8
KL
451 (Done. Whew. It turned out that the problem had nothing to do
452 with hypothetical external references to Wcm, or any other
453 tty_output component; it was simply that delete_tty closed the
454 filehandles of secondary ttys twice, resulting in fclose doubly
3224dac1 455 freeing memory. Utterly trivial matter. I love the C's memory
16c290d8
KL
456 management, it puts hair on your chest.)
457
819b8f00 458-- Support raw secondary terminals. (Note that SIGIO works only on
3224dac1 459 the controlling terminal.) Hint: extend read_input_waiting for
819b8f00 460 multiple ttys and hopefully this will be fixed.
fca177d4 461
819b8f00
KL
462 (Done, it seems to have been working already for some time. It
463 seems F_SETOWN does work, after all. Not sure what made it fail
464 earlier, but it seems to be fixed (there were several changes
465 around request_sigio, maybe one of them did it).
3224dac1 466 read_input_waiting is only used in sys_select, don't change
daf01701 467 it.) (Update: After adding X support, it's broken again.)
c1c63edb 468
819b8f00 469-- Find out why does Emacs abort when it wants to close its
0a125897 470 controlling tty. Hint: chan_process[] array. Hey, maybe
16c290d8
KL
471 noninterrupt-IO would work, too? Update: no, there is no process
472 for stdin/out.
c33d2d42 473
819b8f00
KL
474 (Done. Added add/delete_keyboard_wait_descriptor to
475 term_init/delete_tty. The hint was right, in a way.)
6548cf00 476
819b8f00 477-- Issue with SIGIO: it needs to be disabled during redisplay. See if
3224dac1 478 fcntl kernel behaviour could be emulated by emacsclient.
0a125897 479
819b8f00 480 (Done. Simply disabled the SIGIO emulation hack in emacsclient.)
daf01701 481 (Update: it was added back.)
22de1e79 482
819b8f00 483-- server.el: There are issues with saving files in buffers of closed
16c290d8
KL
484 clients. Try editing a file with emacsclient -f, and (without
485 saving it) do a delete-frame. The frame is closed without
486 question, and a surprising confirmation prompt appears in another
487 frame.
488
819b8f00
KL
489 (Done. delete-frame now asks for confirmation if it still has
490 pending buffers, and modified buffers don't seem to be deleted.)
491
492-- emacsclient.el, server.el: Handle eval or file open errors when
daf01701 493 doing -t.
16c290d8 494
819b8f00 495 (Done.)
22de1e79 496
819b8f00
KL
497-- Make parts of struct tty_output accessible from Lisp. The device
498 name and the type is sufficient.
22de1e79 499
819b8f00
KL
500 (Done, see frame-tty-name and frame-tty-type.)
501
502-- Export delete_tty to the Lisp environment, for emacsclient.
22de1e79 503
819b8f00
KL
504 (Done, see delete-tty.)
505
daf01701
KL
506-- Get rid of the accessor macros in termchar.h, or define macros for
507 all members.
508
509 (Done.)
510
511-- Move device-specific parameters (like costs) commonly used by
512 device backends to a common, device-dependent structure.
513
514 (Done. See struct display_method in termhooks.h.)
515
516-- Fix X support.
517
518 (Done. Well, it seems to be working.)
519
520-- Allow simultaneous X and tty frames. (Handling input could be
521 tricky. Or maybe not.)
522
523 (Done. Allowed, that is. It is currently extremely unstable, to
524 the point of being unusable. The rif variable causes constant
525 core dumps. Handling input is indeed tricky.)
819b8f00 526
7b00d185 527-- Rewrite multi-tty input in terms of MULTI_KBOARD.
28d440ab 528
7b00d185
KL
529 (Done. In fact, there was no need to rewrite anything, I just
530 added a kboard member to tty_display_info, and initialized the
531 frame's kboard from there.)
819b8f00 532
fa971ac3
KL
533-- Fix rif issue with X-tty combo sessions. IMHO the best thing to do
534 is to get rid of that global variable (and use the value value in
535 display_method, which is guaranteed to be correct).
536
537 (Done, did exactly that. Core dumps during combo sessions became
538 much rarer. In fact, I have not yet met a single one.)
539
17086732
KL
540-- Add multi-tty support to talk.el.
541
542 (Done.)
543
428a555e
KL
544-- Clean up the source of emacsclient. It is a mess.
545
546 (Done, eliminated stupid proxy-pty kludge.)
547
548-- Fix faces on tty frames during X-tty combo sessions. There is an
549 init_frame_faces call in init_sys_modes, see if there is a problem
550 with it.
551
552 (Done, there was a stupid mistake in
553 Ftty_supports_face_attributes_p. Colors are broken, though.)
554
555-- C-x 5 2, C-x 5 o, C-x 5 0 on an emacsclient frame unexpectedly
556 exits emacsclient. This is a result of trying to be clever with
557 delete-frame-functions.
558
559 (Fixed, added delete-tty-after-functions, and changed server.el to
560 use it.)
561
562-- Something with (maybe) multi-keyboard support broke function keys
563 and arrows on ttys during X+tty combo sessions. Debug this.
564
565 (I can't reproduce it, maybe the terminal type was wrong.)
566
567-- Fix input from raw ttys (again).
568
569 (Now it seems to work all right.)
570
571-- During an X-tty combo session, a (message "Hello") from a tty frame
572 goes to the X frame. Fix this.
573
574 (Done. There was a safeguard against writing to the initial
575 terminal frame during bootstrap which prevented echo_area_display
576 from working correctly on a tty frame during a combo session.)
577
114a8b8c
KL
578-- If there are no frames on its controlling terminal, Emacs should
579 exit if the uses presses C-c there.
580
581 (Done, as far as possible. See the SIGTERM comment in
582 interrupt_signal on why this seems to be impossible to solve this
583 in general.)
584
585-- During an X session, Emacs seems to read from stdin. Also, Emacs
586 fails to start without a controlling tty.
587
588 (Fixed by replacing the troublesome termcap display with a dummy
589 bootstrap display during bootstrap.
590
591-- Do tty output through struct display, like graphical display
592 backends.
593
594 (Done.)
595
596-- Define an output_initial value for output_method for the initial
597 frame that is dumped with Emacs. Checking for this frame (e.g. in
598 cmd_error_internal) is ugly.
599
600 (Done, broking interactive temacs.)
601
602-- The command `emacsclient -t -e '(delete-frame)'' fails to exit.
603
604 (Fixed.)
605
4ca927b4
KL
606-- frame-creation-function should always create a frame that is on the
607 same display as the selected frame. Maybe frame-creation-function
608 should simply be removed and make-frame changed to do the right
609 thing.
610
611 (Done, with a nice hack. frame-creation-function is now frame-local.)
612
613-- Fix C-g on raw ttys.
614
615 (Done. I disabled the interrupt/quit keys on all secondary
616 terminals, so Emacs sees C-g as normal input. This looks like an
617 overkill, because emacsclient has extra code to pass SIGINT to
618 Emacs, so C-g should remain the interrupt/quit key on emacsclient
619 frames. See the next entry why implementing this distinction would
620 be a bad idea.)
621
622-- Make sure C-g goes to the right frame with ttys. This is hard, as
623 SIGINT doesn't have a tty parameter. :-(
624
625 (Done, the previous change fixes this as a pleasant side effect.)
626
c0707982
KL
627-- I have seen a case when Emacs with multiple ttys fell into a loop
628 eating 100% of CPU time. Strace showed this loop:
629
630 getpid() = 30284
631 kill(30284, SIGIO) = 0
632 --- SIGIO (I/O possible) @ 0 (0) ---
633 ioctl(6, FIONREAD, [0]) = -1 EIO (Input/output error)
634 ioctl(5, FIONREAD, [0]) = -1 EIO (Input/output error)
635 ioctl(0, FIONREAD, [0]) = 0
636 sigreturn() = ? (mask now [])
637 gettimeofday({1072842297, 747760}, NULL) = 0
638 gettimeofday({1072842297, 747806}, NULL) = 0
639 select(9, [0 3 5 6], NULL, NULL, {0, 0}) = 2 (in [5 6], left {0, 0})
640 select(9, [0 3 5 6], NULL, NULL, {0, 0}) = 2 (in [5 6], left {0, 0})
641 gettimeofday({1072842297, 748245}, NULL) = 0
642
643 I have seen something similar with a single X frame, but have not
644 been able to reproduce it for debugging.
645
646 Update: This may have been caused by checking for nread != 0
647 instead of nread > 0 after calling read_socket_hook in
648 read_avail_input.
649
650 (Fixed. This was caused by unconditionally including stdin in
651 input_wait_mask in init_process. The select call in
652 wait_reading_process_input always returned immediately, indicating
653 that there is pending input from stdin, which nobody read.
654
655 Note that the above strace output seems to be an unrelated but
656 similar bug. I think that is now fixed.)
4ca927b4 657
2246281f
KL
658-- Exiting Emacs while there are emacsclient frames doesn't restore the
659 ttys to their default states.
660
661 (This seems to be fixed by some previous change.)
662
663-- Allow opening an X session after -nw.
664
665 (Done.)
666
d448e982
KL
667-- Fix color handling during tty+X combo sessions. (It seems that tty
668 sessions automatically convert the face colors to terminal colors
669 when the face is loaded. This conversion must happen instead on
670 the fly in write_glyphs, which might be problematic, as color
671 approximation is currently done in lisp (term/tty-colors.el).)
672 (Update: hm, colors seem to work fine if I start emacs with -nw and
673 then create an X frame. Maybe it's just a small buglet somewhere.)
674
675 (Seems to be fixed. The problem was in startup.el, it did not
676 initialize tty colors when the initial window system was
677 graphical.)
2246281f 678
2441679b
KL
679-- emacs -nw --eval '(y-or-n-p "Foobar")' segfaults. (Reported by
680 Romain Francoise)
681
682 (Fixed, there was a keyboard initialization problem.)
683
3bbdbec9
KL
684-- Fix interactive use of temacs. There are face-related SEGVs, most
685 likely because of changes in realize_default_face, realize_face.
686
687 (Fixed.)
688
bacb6689
KL
689-- Don't exit Emacs when the last X connection fails during a
690 multi-display session.
691
692 (Fixed.)
693
0c72d684
KL
694
695-- Dan Nicolaescu noticed that starting emacsclient on the same
696 terminal device that is the controlling tty of the Emacs process
697 gives unexpected results.
698
699 (Fixed.)
700
4edd8a5c
KL
701-- Istvan Marko reported that Emacs hang on ttys if it was started
702 from a shell script.
703
704 (Fixed. There was a bug in the multi-tty version of
705 narrow_foreground_group. tcsetpgrp blocks if it is called from a
706 process that is not in the same process group as the tty.)
707
2fc0cf2a
KL
708-- emacsclient -t from an Emacs term buffer does not work, complains
709 about face problems. This can even lock up Emacs (if the recursive
710 frame sets single_kboard). Update: the face problems are caused by
711 bugs in term.el, not in multi-tty. The lockup is caused by
712 single_kboard mode, and is not easily solvable. The best thing to
713 do is to simply refuse to create a tty frame of type `eterm'.
714
715 (Fixed, changed emacsclient to check for TERM=eterm. The face
716 complaints seem to be caused by bugs in term.el; they are not
717 related to multi-tty.)
718
0b0d3e0b
KL
719-- Find out the best way to support suspending Emacs with multiple
720 ttys. My guess: disable it on the controlling tty, but from other
721 ttys pass it on to emacsclient somehow. (It is (I hope) trivial to
722 extend emacsclient to handle suspend/resume. A `kill -STOP' almost
723 works right now.)
724
725 (Done. I needed to play with signal handling and the server
726 protocol a bit to make emacsclient behave as a normal UNIX program
727 wrt foreground/background process groups.)
728
eb1f46c9
KL
729-- There is a flicker during the startup of `emacs -nw'; it's as if
730 the terminal is initialized, reset and then initialialized again.
731 Debug this. (Hint: narrow_foreground_group is called twice during
732 startup.)
733
734 (This is gone.)
735
026ad6ba
KL
736-- Robert Chassell has found serious copy-paste bugs with the
737 multi-tty branch. There seem to be redisplay bugs while copying
738 from X to a terminal frame. Copying accented characters do not
739 work for me.
740
741 (Patch-124 should fix this, by changing the interprogram-*-function
742 variables to be frame-local, as suggested by Mark Plaksin
743 (thanks!). I think that the redisplay bugs are in fact not bugs,
744 but delays caused by single_kboard --> perhaps MULTI_KBOARD should
745 be removed.)
746
747
0b0d3e0b 748
28d440ab 749;;; arch-tag: 8da1619e-2e79-41a8-9ac9-a0485daad17d