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