1 -*- coding: utf-8; mode: text; -*-
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
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
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
26 I'm Károly Lőrentey. My address: lorentey@elte.hu.
28 Comments, bug reports, suggestions and patches are welcome; send them
29 to multi-tty@lists.fnord.hu.
34 The multi-tty mailing list (discussion & bug reports):
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/
40 Commit notifications (read-only):
42 Address: multi-tty-commits@lists.fnord.hu
43 Signup: http://lists.fnord.hu/mailman/listinfo/multi-tty-commits
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.
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.
61 Tested on GNU/Linux, Solaris 8, FreeBSD and OpenBSD. Please let me
62 know if you succeed or fail to use it on other platforms---I'll have a
63 few tricky test cases for you.
67 * Mac, Windows and DOS support is broken, probably doesn't
68 even compile -- this will be solved later.
73 The branch uses GNU Arch (http://www.gnuarch.org) for version control.
75 Retrieving the latest version of the branch:
77 tla register-archive http://lorentey.hu/arch/2004/
78 tla get lorentey@elte.hu--2004/emacs--multi-tty <directory>
80 This incantation uses my private archive mirror that is hosted on a
81 relatively low-bandwidth site; if you are outside Hungary, you will
82 probably want to you use the Arch supermirror instead:
84 tla register-archive http://mirrors.gnuarch.org/lorentey@elte.hu--2004/
85 tla get lorentey@elte.hu--2004/emacs--multi-tty <directory>
87 (I use a recent tla development snapshot, but any of the released
88 versions of arch will do fine, I think.) My GPG key id is 0FB27A3F;
89 it is available from hkp://wwwkeys.eu.pgp.net/, or my homepage at
90 http://lorentey.hu/rolam/gpg.html)
92 To update your source tree to the latest revision after the first
93 checkout, simply use the following command:
95 tla replay lorentey@elte.hu--2004/emacs--multi-tty--0
97 If you are interested, you can find more information about Arch on
98 http://wiki.gnuarch.org/. It's a wonderful source control system, I
101 If you don't have tla, the branch has a homepage from which you can
102 download conventional patches against Emacs CVS HEAD:
104 http://lorentey.hu/project/emacs.html
110 The multi-tty branch is compiled the same way as Emacs itself:
112 make maintainer-clean # (If you have compiled Emacs before)
114 ./configure <your favourite options>
118 If you have strange compilation errors, they may be caused by old
119 *.elc files that are left over from an earlier bootstrap. The `make
120 maintainer-clean' target deletes them, so it is a good idea to run
121 that before reporting a bug. (Emacs requires a clean recompilation
122 after certain kinds of source code changes.)
127 To test the multi-tty branch, start up the Emacs server with the
133 and then (from a shell prompt on another terminal) start emacsclient
135 emacsclient -t /optional/file/names... (for a tty frame)
136 emacsclient /optional/file/names... (for an X frame)
138 (Make sure both emacs and emacsclient are multi-tty versions.)
139 You'll hopefully have two fully working, independent frames on
140 separate terminals. The new frame is closed automatically when you
141 finish editing the specified files (C-x #), but delete-frame (C-x 5 0)
142 also works. Of course, you can create frames on more than two tty
145 Creating new frames on the same tty with C-x 5 2 works, and they
146 behave the same way as in previous Emacs versions. If you exit emacs,
147 all terminals should be restored to their previous states.
149 This is work in progress, and probably full of bugs. You should
150 always run emacs from gdb, so that you'll have a live instance to
151 debug if something goes wrong. Please send me
152 (multi-tty@lists.fnord.hu) your bug reports.
157 I think the best way to use the new Emacs is to have it running inside
158 a disconnected GNU screen session, and always use emacsclient for
159 normal work. One advantage of this is that not a single keystroke of
160 your work will be lost if the display device that you are using
161 crashes, or the network connection times out, or whatever. (I had an
162 extremely unstable X server for some time while I was developing these
163 patches, and running Emacs this way has saved me a number of M-x
164 recover-session invocations.)
166 I use the following two bash functions to handle my Emacs sessions:
168 ,----[ ~/.bash_profile
169 | # Usage: preload-emacs <name> [<waitp>]
171 | # Preloads the Emacs instance called NAME in a detached screen
172 | # session. Does nothing if the instance is already running. If WAITP
173 | # is non-empty, the function waits until the server starts up and
174 | # creates its socket; otherwise it returns immediately.
175 | function preload-emacs {
178 | local screendir="/var/run/screen/S-$USER"
179 | local serverdir="/tmp/emacs$UID"
180 | local emacs=emacs # Or wherever you installed your multi-tty Emacs
182 | if [ -z "$name" ]; then
183 | echo "Usage: preload-emacs <name> [<waitp>]" >&2
187 | if [ ! -e "$screendir"/*."$name" ]; then
188 | if [ -e "$serverdir/$name" ]; then
189 | # Delete leftover socket (for the wait option)
190 | rm "$serverdir/$name"
192 | screen -dmS "$name" "$emacs" -nw --eval "(setq server-name \"$name\")" -f server-start
194 | if [ ! -z "$waitp" ]; then
195 | while [ ! -e "$serverdir/$name" ]; do sleep 0.1; done
200 | # Usage: connect-emacs <name> <args>...
202 | # Connects to the Emacs instance called NAME. Starts up the instance
203 | # if it is not already running. The rest of the arguments are passed
205 | function connect-emacs {
209 | if [ -z "$name" ]; then
210 | echo "Usage: connect-emacs <name> <args>..." >&2
212 | preload-emacs "$name" wait
213 | emacsclient -s "$name" "$@"
216 | export -f preload-emacs connect-emacs
218 | # Preload editor and gnus sessions for speedy initial connects.
219 | preload-emacs editor
224 | alias gnus="connect-emacs gnus"
225 | alias edit="connect-emacs editor"
226 | alias et="connect-emacs editor -t"
234 For the NEWS file: (Needs work)
236 ** Support for multiple terminal devices has been added.
238 *** You can specify a terminal device (`tty' parameter) and a terminal
239 type (`tty-type' parameter) to `make-terminal-frame'.
241 *** You can test for the presence of multiple terminal support by
242 testing for the `multi-tty' feature.
244 *** Emacsclient has been extended to support opening a new terminal
245 frame. Its behaviour has been changed to open a new Emacs frame by
246 default. Use the -c option to get the old behavior of opening
247 files in the currently selected Emacs frame.
249 *** A make-frame-on-tty function has been added to make it easier to
250 create frames on new terminals.
252 *** New functions: frame-tty-name, frame-tty-type for accessing
253 terminal parameters, and delete-tty for closing the terminal
256 *** talk.el has been extended for multiple tty support.
259 ** Support for simultaneous graphical and terminal frames has been
262 *** The function `make-frame-on-display' now works during a terminal
263 session, and `make-frame-on-tty' works during a graphical session.
265 *** The `window-system' variable has been made frame-local.
267 *** The new `initial-window-system' variable contains the
268 `window-system' value for the first frame.
273 The following is a (sadly incomplete) list of people who have
274 contributed to the project by testing, submitting patches, bug
275 reports, and suggestions. Thanks!
277 ARISAWA Akihiro <ari at mbf dot ocn dot ne dot jp>
278 Han Boetes <han at mijncomputer dot nl>
279 Robert J. Chassell <bob at rattlesnake dot com>
280 Romain Francoise <romain at orebokech dot com>
281 Ami Fischman <ami at fischman dot org>
282 Friedrich Delgado Friedrichs <friedel at nomaden dot org>
283 IRIE Tetsuya <irie at t dot email dot ne dot jp>
284 Yoshiaki Kasahara <kasahara at nc dot kyushu-u dot ac dot jp>
285 Jurej Kubelka <Juraj dot Kubelka at email dot cz>
286 David Lichteblau <david at lichteblau dot com>
287 Istvan Marko <mi-mtty at kismala dot com>
288 Ted Morse <morse at ciholas dot com>
289 Dan Nicolaescu <dann at ics dot uci dot edu>
290 Gergely Nagy <algernon at debian dot org>
291 Mark Plaksin <happy at mcplaksin dot org>
292 Francisco Borges <borges at let dot rug dot nl>
293 Frank Ruell <stoerte at dreamwarrior dot net>
294 Dan Waber <dwaber at logolalia dot com>
297 Richard Stallman was kind enough to review an earlier version of my
307 (The rest of this file consists of my development notes and as such it
308 is probably not very interesting for anyone else.)
313 ** Hunt down display-related functions in frame.el and extend them all
314 to accept display ids.
316 ** Have a look at fatal_error_hook.
318 ** Check if we got term-setup-hook right.
320 ** make-frame does not correctly handle extra parameters in its
323 (frame-parameter (make-frame (list (cons 'foobar 42))) 'foobar)
326 (This is likely an error in the CVS trunk.)
328 ** Fix set-input-mode for multi-tty. It's a truly horrible interface;
329 what if we'd blow it up into several separate functions (with a
330 compatibility definition)?
332 ** Lisp-level stuff that needs to be updated for multi-tty:
334 - normal-erase-is-backspace-mode (simple.el) (rep. by Dan Waber)
337 ** The single-keyboard mode of MULTI_KBOARD is extremely confusing
338 sometimes; Emacs does not respond to stimuli from other keyboards.
339 At least a beep or a message would be important, if the single-mode
340 is still required to prevent interference. (Reported by Dan
341 Nicolaescu.) (Update: selecting a region with the mouse enables
342 single_kboard under X. This is very confusing.) Update:
343 After discussions with Richard, this will be resolved by having
344 locked displays warn the user to wait, and introducing a complex
345 protocol to remotely bail out of single-kboard mode by pressing C-g.
347 ** The terminal customization files in term/*.el tend to change global
348 parameters, which may confuse Emacs with multiple displays. Change
349 them to tweak only frame-local settings, if possible.
351 ** Dan Nicolaescu suggests that -nw should be added as an alias for -t
352 in emacsclient. Good idea. (Alas, implementing this is not
353 trivial, getopt_long does not seem to support two-letter ``short''
354 options. Patches are welcome.) :-)
356 ** Mark Plaksin suggests that emacsclient should accept the same
357 X-related command-line arguments as Emacs. Most of the X-related
358 argument-handling is done in Lisp, so this should be quite easy to
361 ** Gergely Nagy suggests that C-x # should only kill the current
362 frame, not any other emacsclient frame that may have the same file
363 opened for editing. I think I agree with him.
365 ** Miles Bader suggests that C-x C-c on an emacsclient frame should
366 only close the frame, not exit the entire Emacs session. Update:
367 see above for a function that does this. Maybe this should be the
370 ** Very strange bug: visible-bell does not work on secondary
371 terminals in xterm and konsole. The screen does flicker a bit,
372 but it's so quick it isn't noticable.
374 ** Clean up the frame-local variable system. I think it's ugly and
375 error-prone. But maybe I just haven't yet fully understood it.
377 ** Move baud_rate to struct display.
379 ** Implement support for starting an interactive Emacs session without
380 an initial frame. (The user would connect to it and open frames
381 later, with emacsclient.)
383 ** Fix Mac support (I can't do this entirely myself). Note that the
384 current state of Mac-specific source files in the multi-tty tree
385 are not useful; before starting work on Mac support, revert to
386 pristine, pre-multi-tty versions.
388 ** Fix W32 support (I can't do this entirely myself). Note that the
389 current state of W32-specific source files in the multi-tty tree
390 are not useful; before starting work on W32 support, revert to
391 pristine, pre-multi-tty versions.
393 ** Fix DOS support (I can't do this entirely myself). Note that the
394 current state of DOS-specific source files in the multi-tty tree
395 are not useful; before starting work on DOS support, revert to
396 pristine, pre-multi-tty versions.
398 ** Do a grep on XXX and ?? for more issues.
400 ** Understand Emacs's low-level input system (it's black magic) :-)
401 What exactly does interrupt_input do? I tried to disable it for
402 raw secondary tty support, but it does not seem to do anything
403 useful. (Update: Look again. X unconditionally enables this, maybe
404 that's why raw terminal support is broken again. I really do need
405 to understand input.)
407 ** Maybe standard-display-table should be display-local.
412 (ex-TODO items with explanations.)
414 -- Introduce a new struct for terminal devices.
416 (Done, see struct tty_output. The list of members is not yet
419 -- Change the bootstrap procedure to initialize tty_list.
421 (Done, but needs review.)
423 -- Change make-terminal-frame to support specifying another tty.
425 (Done, new frame parameters: `tty' and `tty-type'.)
427 -- Implement support for reading from multiple terminals.
429 (Done, read_avail_input tries to read from each terminal, until one
430 succeeds. MULTI_KBOARD is not used. Secondary terminals don't send
433 (Update: They do, now.)
435 (Update2: After enabling X, they don't.)
437 -- other-frame should cycle through the frames on the `current'
440 (Done, by trivially modifiying next_frame and prev_frame.)
442 -- Support different terminal sizes.
446 -- Make sure terminal resizes are handled gracefully. (Could be
449 (Done. We don't get automatic SIGWINCH for additional ttys,
452 -- Extend emacsclient to automatically open a new tty when it connects
455 (Done. It's an ugly hack, needs more work.)
457 -- Redisplay must refresh the topmost frame on *all* terminals, not
458 just the initial terminal.
460 (Done, but introduced an ugly redisplay problems. Ugh.)
462 -- Fix redisplay problems.
464 (Done; it turned out that the entire Wcm structure must be moved
465 inside tty_output. Why didn't I catch this earlier?)
467 -- Provide a way for emacsclient to tell Emacs that the tty has been
470 (Done, simply forward the SIGWINCH signal.)
472 -- Each keypress should automatically select the frame corresponding
473 to the terminal that it was coming from. This means that Emacs
474 must know from which terminal the last keyboard event came from.
476 (Done, it was quite simple, the input event system already
477 supported multiple frames.)
479 -- Fix SIGIO issue with secondary terminals.
481 (Done, emacsclient signals Emacs after writing to the proxy pseudo
482 terminal. Note that this means that multi-tty does not work with
485 (Update: This is bullshit. There is a read_input_waiting function,
486 extend that somehow.)
488 (Update of update: The first update was not right either, extending
489 read_input_waiting was not necessary. Secondary ttys do seem to
490 send signals on input.)
492 (Update^3: Not any more.)
494 -- Make make-terminal-frame look up the `tty' and `tty-type' frame
495 parameters from the currently selected terminal before the global
500 -- Put all cached terminal escape sequences into struct tty_output.
501 Currently, they are still stored in global variables, so we don't
502 really support multiple terminal types.
504 (Done. It was not fun.)
506 -- Implement sane error handling after initialization. (Currently
507 emacs exits if you specify a bad terminal type.) The helpful error
508 messages must still be provided when Emacs starts.
512 -- Implement terminal deletion, i.e., deleting local frames, closing
513 the tty device and restoring its previous state without exiting
516 (Done, but at the moment only called when an error happens during
517 initialization. There is a memory corruption error around this
518 somewhere.) (Update: now it is fully enabled.)
520 -- Implement automatic deletion of terminals when the last frame on
521 that terminal is closed.
525 -- Restore tty screen after closing the terminal.
527 (Done, we do the same as Emacs 21.2 for all terminals.)
529 -- 'TERM=dumb src/emacs' does not restore the terminal state.
533 -- C-g should work on secondary terminals.
535 (Done, but the binding is not configurable.)
537 -- Deal with SIGHUP in Emacs and in emacsclient. (After this, the
538 server-frames may be removed from server.el.)
540 (Done, nothing to do. It seems that Emacs does not receive SIGHUP
541 from secondary ttys, which is actually a good thing.) (Update: I
542 think it would be a bad idea to remove server-frames.)
544 -- Change emacsclient/server.el to support the -t argument better,
545 i.e. automatically close the socket when the frame is closed.
547 (Seems to be working OK.)
549 -- Fix mysterious memory corruption error with tty deletion. To
550 trigger it, try the following shell command:
552 while true; do TERM=no-such-terminal-definition emacsclient -h; done
554 Emacs usually dumps core after a few dozen iterations. (The bug
555 seems to be related to the xfreeing or bzeroing of
556 tty_output.Wcm. Maybe there are outside references to struct Wcm?
557 Why were these vars collected into a struct before multi-tty
560 (Done. Whew. It turned out that the problem had nothing to do
561 with hypothetical external references to Wcm, or any other
562 tty_output component; it was simply that delete_tty closed the
563 filehandles of secondary ttys twice, resulting in fclose doubly
564 freeing memory. Utterly trivial matter. I love the C's memory
565 management, it puts hair on your chest.)
567 -- Support raw secondary terminals. (Note that SIGIO works only on
568 the controlling terminal.) Hint: extend read_input_waiting for
569 multiple ttys and hopefully this will be fixed.
571 (Done, it seems to have been working already for some time. It
572 seems F_SETOWN does work, after all. Not sure what made it fail
573 earlier, but it seems to be fixed (there were several changes
574 around request_sigio, maybe one of them did it).
575 read_input_waiting is only used in sys_select, don't change
576 it.) (Update: After adding X support, it's broken again.)
577 (Update^2: No it isn't.) :-)
579 -- Find out why does Emacs abort when it wants to close its
580 controlling tty. Hint: chan_process[] array. Hey, maybe
581 noninterrupt-IO would work, too? Update: no, there is no process
584 (Done. Added add/delete_keyboard_wait_descriptor to
585 term_init/delete_tty. The hint was right, in a way.)
587 -- Issue with SIGIO: it needs to be disabled during redisplay. See if
588 fcntl kernel behaviour could be emulated by emacsclient.
590 (Done. Simply disabled the SIGIO emulation hack in emacsclient.)
591 (Update: it was added back.) (Update^2: and removed again.)
593 -- server.el: There are issues with saving files in buffers of closed
594 clients. Try editing a file with emacsclient -f, and (without
595 saving it) do a delete-frame. The frame is closed without
596 question, and a surprising confirmation prompt appears in another
599 (Done. delete-frame now asks for confirmation if it still has
600 pending buffers, and modified buffers don't seem to be deleted.)
602 -- emacsclient.el, server.el: Handle eval or file open errors when
607 -- Make parts of struct tty_output accessible from Lisp. The device
608 name and the type is sufficient.
610 (Done, see frame-tty-name and frame-tty-type.)
612 -- Export delete_tty to the Lisp environment, for emacsclient.
614 (Done, see delete-tty.)
616 -- Get rid of the accessor macros in termchar.h, or define macros for
621 -- Move device-specific parameters (like costs) commonly used by
622 device backends to a common, device-dependent structure.
624 (Done. See struct display_method in termhooks.h.)
628 (Done. Well, it seems to be working.)
630 -- Allow simultaneous X and tty frames. (Handling input could be
631 tricky. Or maybe not.)
633 (Done. Allowed, that is. It is currently extremely unstable, to
634 the point of being unusable. The rif variable causes constant
635 core dumps. Handling input is indeed tricky.)
637 -- Rewrite multi-tty input in terms of MULTI_KBOARD.
639 (Done. In fact, there was no need to rewrite anything, I just
640 added a kboard member to tty_display_info, and initialized the
641 frame's kboard from there.)
643 -- Fix rif issue with X-tty combo sessions. IMHO the best thing to do
644 is to get rid of that global variable (and use the value value in
645 display_method, which is guaranteed to be correct).
647 (Done, did exactly that. Core dumps during combo sessions became
648 much rarer. In fact, I have not yet met a single one.)
650 -- Add multi-tty support to talk.el.
654 -- Clean up the source of emacsclient. It is a mess.
656 (Done, eliminated stupid proxy-pty kludge.)
658 -- Fix faces on tty frames during X-tty combo sessions. There is an
659 init_frame_faces call in init_sys_modes, see if there is a problem
662 (Done, there was a stupid mistake in
663 Ftty_supports_face_attributes_p. Colors are broken, though.)
665 -- C-x 5 2, C-x 5 o, C-x 5 0 on an emacsclient frame unexpectedly
666 exits emacsclient. This is a result of trying to be clever with
667 delete-frame-functions.
669 (Fixed, added delete-tty-after-functions, and changed server.el to
672 -- Something with (maybe) multi-keyboard support broke function keys
673 and arrows on ttys during X+tty combo sessions. Debug this.
675 (I can't reproduce it, maybe the terminal type was wrong.)
677 -- Fix input from raw ttys (again).
679 (Now it seems to work all right.)
681 -- During an X-tty combo session, a (message "Hello") from a tty frame
682 goes to the X frame. Fix this.
684 (Done. There was a safeguard against writing to the initial
685 terminal frame during bootstrap which prevented echo_area_display
686 from working correctly on a tty frame during a combo session.)
688 -- If there are no frames on its controlling terminal, Emacs should
689 exit if the user presses C-c there.
691 (Done, as far as possible. See the SIGTERM comment in
692 interrupt_signal on why this seems to be impossible to solve this
695 -- During an X session, Emacs seems to read from stdin. Also, Emacs
696 fails to start without a controlling tty.
698 (Fixed by replacing the troublesome termcap display with a dummy
699 bootstrap display during bootstrap.
701 -- Do tty output through struct display, like graphical display
706 -- Define an output_initial value for output_method for the initial
707 frame that is dumped with Emacs. Checking for this frame (e.g. in
708 cmd_error_internal) is ugly.
710 (Done, broking interactive temacs.)
712 -- The command `emacsclient -t -e '(delete-frame)'' fails to exit.
716 -- frame-creation-function should always create a frame that is on the
717 same display as the selected frame. Maybe frame-creation-function
718 should simply be removed and make-frame changed to do the right
721 (Done, with a nice hack. frame-creation-function is now frame-local.)
723 -- Fix C-g on raw ttys.
725 (Done. I disabled the interrupt/quit keys on all secondary
726 terminals, so Emacs sees C-g as normal input. This looks like an
727 overkill, because emacsclient has extra code to pass SIGINT to
728 Emacs, so C-g should remain the interrupt/quit key on emacsclient
729 frames. See the next entry why implementing this distinction would
732 -- Make sure C-g goes to the right frame with ttys. This is hard, as
733 SIGINT doesn't have a tty parameter. :-(
735 (Done, the previous change fixes this as a pleasant side effect.)
737 -- I have seen a case when Emacs with multiple ttys fell into a loop
738 eating 100% of CPU time. Strace showed this loop:
741 kill(30284, SIGIO) = 0
742 --- SIGIO (I/O possible) @ 0 (0) ---
743 ioctl(6, FIONREAD, [0]) = -1 EIO (Input/output error)
744 ioctl(5, FIONREAD, [0]) = -1 EIO (Input/output error)
745 ioctl(0, FIONREAD, [0]) = 0
746 sigreturn() = ? (mask now [])
747 gettimeofday({1072842297, 747760}, NULL) = 0
748 gettimeofday({1072842297, 747806}, NULL) = 0
749 select(9, [0 3 5 6], NULL, NULL, {0, 0}) = 2 (in [5 6], left {0, 0})
750 select(9, [0 3 5 6], NULL, NULL, {0, 0}) = 2 (in [5 6], left {0, 0})
751 gettimeofday({1072842297, 748245}, NULL) = 0
753 I have seen something similar with a single X frame, but have not
754 been able to reproduce it for debugging.
756 Update: This may have been caused by checking for nread != 0
757 instead of nread > 0 after calling read_socket_hook in
760 (Fixed. This was caused by unconditionally including stdin in
761 input_wait_mask in init_process. The select call in
762 wait_reading_process_input always returned immediately, indicating
763 that there is pending input from stdin, which nobody read.
765 Note that the above strace output seems to be an unrelated but
766 similar bug. I think that is now fixed.)
768 -- Exiting Emacs while there are emacsclient frames doesn't restore the
769 ttys to their default states.
771 (This seems to be fixed by some previous change.)
773 -- Allow opening an X session after -nw.
777 -- Fix color handling during tty+X combo sessions. (It seems that tty
778 sessions automatically convert the face colors to terminal colors
779 when the face is loaded. This conversion must happen instead on
780 the fly in write_glyphs, which might be problematic, as color
781 approximation is currently done in lisp (term/tty-colors.el).)
782 (Update: hm, colors seem to work fine if I start emacs with -nw and
783 then create an X frame. Maybe it's just a small buglet somewhere.)
785 (Seems to be fixed. The problem was in startup.el, it did not
786 initialize tty colors when the initial window system was
789 -- emacs -nw --eval '(y-or-n-p "Foobar")' segfaults. (Reported by
792 (Fixed, there was a keyboard initialization problem.)
794 -- Fix interactive use of temacs. There are face-related SEGVs, most
795 likely because of changes in realize_default_face, realize_face.
799 -- Don't exit Emacs when the last X connection fails during a
800 multi-display session.
804 -- Dan Nicolaescu noticed that starting emacsclient on the same
805 terminal device that is the controlling tty of the Emacs process
806 gives unexpected results.
810 -- Istvan Marko reported that Emacs hang on ttys if it was started
813 (Fixed. There was a bug in the multi-tty version of
814 narrow_foreground_group. tcsetpgrp blocks if it is called from a
815 process that is not in the same process group as the tty.)
817 -- emacsclient -t from an Emacs term buffer does not work, complains
818 about face problems. This can even lock up Emacs (if the recursive
819 frame sets single_kboard). Update: the face problems are caused by
820 bugs in term.el, not in multi-tty. The lockup is caused by
821 single_kboard mode, and is not easily resolvable. The best thing to
822 do is to simply refuse to create a tty frame of type `eterm'.
824 (Fixed, changed emacsclient to check for TERM=eterm. The face
825 complaints seem to be caused by bugs in term.el; they are not
826 related to multi-tty.)
828 -- Find out the best way to support suspending Emacs with multiple
829 ttys. My guess: disable it on the controlling tty, but from other
830 ttys pass it on to emacsclient somehow. (It is (I hope) trivial to
831 extend emacsclient to handle suspend/resume. A `kill -STOP' almost
834 (Done. I needed to play with signal handling and the server
835 protocol a bit to make emacsclient behave as a normal UNIX program
836 wrt foreground/background process groups.)
838 -- There is a flicker during the startup of `emacs -nw'; it's as if
839 the terminal is initialized, reset and then initialialized again.
840 Debug this. (Hint: narrow_foreground_group is called twice during
845 -- Robert Chassell has found serious copy-paste bugs with the
846 multi-tty branch. There seem to be redisplay bugs while copying
847 from X to a terminal frame. Copying accented characters do not
850 (Patch-124 should fix this, by changing the interprogram-*-function
851 variables to be frame-local, as suggested by Mark Plaksin
852 (thanks!). I think that the redisplay bugs are in fact not bugs,
853 but delays caused by single_kboard --> perhaps MULTI_KBOARD should
856 -- frame-creation-function was removed, which might be a bad idea.
857 Think up a compatible solution.
859 (It was an internal interface that may be changed when necessary.)
861 -- Change Lisp code not to (getenv "TERM"); use the `tty-type' frame
862 parameter or the frame-tty-type function instead. (M-x tags-search
863 "TERM" helps with this.) Update: Actually, all getenv invocations
864 should be checked for multi-tty compatibility, and an interface
865 must be implemented to get the remote client's environment.
867 (Done. Only getenv calls in lisp/term/*.el were changed; other
868 calls should be mostly left as they are.)
870 -- Add an elaborate mechanism for display-local variables. (There are
871 already a few of these; search for `terminal-local' in the Elisp
874 (Not needed. Display-local variables could be emulated by
875 frame-local variables.)
877 -- Emacs assumes that all terminal frames have the same locale
878 settings as Emacs itself. This may lead to bogus results in a
879 multi-locale setup. (E.g., while logging in from a remote client
880 with a different locale.)
881 (Update after new bugreport by Friedrich Delgado Friedrichs:
882 (at least) the structs terminal_coding and keyboard_coding in
883 coding.c must be moved to struct display, and the Lisp interface
884 [set-]keyboard-coding-system must be adapted for the change.)
886 (Fixed. Emacs now uses the locale settings as seen by the
887 emacsclient process for server tty frames.)
890 -- Make `struct display' accessible to Lisp programs. Accessor functions:
892 (displayp OBJECT): Returns t if OBJECT is a display.
893 => Implemented as display-live-p.
895 (display-list): Returns list of currently active displays.
898 (selected-display): Returns the display object of the selected frame.
899 => Not strictly necessary, but implemented anyway.
901 (frame-display FRAME): Returns the display object of FRAME.
904 (display-frames DISPLAY): Returns a list of frames on DISPLAY.
905 => Already implemented, see frames-on-display-list.
907 (display-type DISPLAY): Returns the type of DISPLAY, as a
908 symbol. (See `framep'.)
909 => Implemented as display-live-p.
911 (display-device DISPLAY): Returns the name of the device that
912 DISPLAY uses, as a string. (E.g: "/dev/pts/16", or
914 => Implemented as display-name.
918 See next issue why this is necessary.
920 (Update: The consensus on emacs-devel seems to be to do this via
921 integer identifiers. That's fine by me.)
925 -- The following needs to be supported:
932 The cleanest way to solve this is to allow multiple displays on the
933 same terminal device; each new emacsclient process should create
934 its own display. As displays are currently identified by their
935 device names, this is not possible until struct display becomes
936 accessible as a Lisp-level object.
940 ;;; arch-tag: 8da1619e-2e79-41a8-9ac9-a0485daad17d