1 -*- coding: utf-8; mode: text; -*-
5 This branch implements support for opening multiple, different tty
6 devices and simultaneous X and tty frames from a single Emacs session.
9 Emacs is notoriously slow at startup, so most people use another
10 editor or emacsclient for quick editing jobs from the console.
11 Unfortunately, emacsclient was very awkward to use, because it did not
12 support opening a new Emacs frame on the current virtual tty.
13 Now, with multi-tty support, it can do that. (Emacsclient starts up
16 Some Gnus users (including me) run Gnus in an X frame in its own Emacs
17 instance, which they typically leave running for weeks. It would be
18 nice if they could connect to this instance from a remote ssh session
19 and check their messages without opening a remote X frame or resorting
25 I'm Károly Lőrentey. My address: lorentey@elte.hu.
27 Comments, bug reports, suggestions and patches are welcome; send them
28 to multi-tty@lists.fnord.hu.
30 The following is a (sadly incomplete) list of people who have
31 contributed to the project by testing, submitting patches, bug
32 reports, and suggestions. Thanks!
34 Bernard Adrian <bernadrian@free.fr>
35 ARISAWA Akihiro <ari@mbf.ocn.ne.jp>
36 Vincent Bernat <bernat@luffy.cx>
37 Han Boetes <han@mijncomputer.nl>
38 Francisco Borges <borges@let.rug.nl>
39 Damien Cassou <damien.cassou@laposte.net>
40 Robert J. Chassell <bob@rattlesnake.com>
41 Romain Francoise <romain@orebokech.com>
42 Ami Fischman <ami@fischman.org>
43 Friedrich Delgado Friedrichs <friedel@nomaden.org>
44 IRIE Tetsuya <irie@t.email.ne.jp>
45 Yoshiaki Kasahara <kasahara@nc.kyushu-u.ac.jp>
46 Bas Kok <nekkobassu@yahoo.com>
47 Jurej Kubelka <Juraj.Kubelka@email.cz>
48 David Lichteblau <david@lichteblau.com>
49 mace <mace@kirjakaapeli.lib.hel.fi>
50 Suresh Madhu <madhu@cs.unm.edu>
51 Xavier Mallard <zedek@gnu-rox.org>
52 Istvan Marko <mi-mtty@kismala.com>
53 Ted Morse <morse@ciholas.com>
54 Gergely Nagy <algernon@debian.org>
55 Dan Nicolaescu <dann@ics.uci.edu>
56 Kalle Olavi Niemitalo <kon@iki.fi>
57 Mark Plaksin <happy@mcplaksin.org>
58 Frank Ruell <stoerte@dreamwarrior.net>
59 Tom Schutzer-Weissmann <trmsw@yahoo.co.uk>
60 Joakim Verona <joakim@verona.se>
61 Dan Waber <dwaber@logolalia.com>
64 Richard Stallman was kind enough to review an earlier version of my
71 The multi-tty mailing list (discussion & bug reports):
73 Address: multi-tty@lists.fnord.hu
74 Signup: http://lists.fnord.hu/mailman/listinfo/multi-tty
75 Archive: http://news.gmane.org/gmane.emacs.multi-tty/
77 Commit notifications (read-only):
79 Address: multi-tty-commits@lists.fnord.hu
80 Signup: http://lists.fnord.hu/mailman/listinfo/multi-tty-commits
86 The branch is now very stable and almost full-featured. All of the
87 major problems have been fixed, only a few minor issues remain. (It
88 still needs to be ported to Windows/Mac/DOS, though.) Both multiple
89 tty device support and simultaneous X and tty frame support works
90 fine. Emacsclient has been extended to support opening new tty and X
91 frames. It has been changed to open new Emacs frames by default.
93 The multi-tty branch has been scheduled for inclusion in the next
94 major release of Emacs (version 23). I expect the merge into the
95 development trunk to occur sometime during next year (2006), after the
96 merge of the Unicode branch.
98 Tested on GNU/Linux, Solaris 8, FreeBSD and OpenBSD. Please let me
99 know if you succeed or fail to use it on other platforms---I'll have a
100 few tricky test cases for you.
104 * GTK support. If you compile your Emacs with the GTK
105 toolkit, some functionality of multi-tty will be lost. In
106 particular, you will not be able to work on multiple X
107 displays at once. Current releases of GTK have limitations
108 and bugs that prevent full-blown multi-display support in
109 Emacs. (GTK crashes when Emacs tries to disconnect from an
110 X server.) Use the Lucid toolkit if you want to see a
111 complete feature set.
113 * The single-kboard mode.
115 If your multi-tty Emacs session seems to be frozen, you
116 probably have a recursive editing session or a pending
117 minibuffer prompt (which is a kind of recursive editing) on
118 another display. To unfreeze your session, switch to that
119 display and complete the recursive edit, for example by
120 pressing C-] (`abort-recursive-edit').
122 I am sorry to say that currently there is no way to break
123 out of this "single-kboard mode" from a frozen display. If
124 you are unable to switch to the display that locks the
125 others (for example because it is on a remote computer),
126 then you can use emacsclient to break out of all recursive
129 emacsclient -e '(top-level)'
131 Note that this (perhaps) unintuitive behaviour is by design.
132 Single-kboard mode is required because of an intrinsic Emacs
133 limitation that is very hard to eliminate. (This limitation
134 is related to the single-threaded nature of Emacs.)
136 I plan to implement better user notification and support for
137 breaking out of single-kboard mode from locked displays.
139 * Mac, Windows and DOS support is broken, doesn't even
140 compile. Multiple display support will probably not provide
141 new Emacs features on these systems, but the multi-tty
142 branch changed a few low-level interfaces, and the
143 system-dependent source files need to be adapted
144 accordingly. The changes are mostly trivial, so almost
145 anyone can help, if only by compiling the branch and
146 reporting the compiler errors.
149 HOW TO GET THE BRANCH
150 ---------------------
152 The branch uses Bazaar 1 (http://bazaar.canonical.com) for version control.
154 Retrieving the latest version of the branch:
156 baz register-archive -f http://aszt.inf.elte.hu/~lorentey/mirror/arch/2004
157 baz get lorentey@elte.hu--2004/emacs--multi-tty <directory>
159 This incantation uses an archive mirror that is hosted on a
160 high-bandwidth site. Please note that on average there is a two-hour
161 delay for commits to arrive on this mirror. My primary mirror is on the
162 low-bandwidth http://lorentey.hu/ site:
164 baz register-archive -f http://lorentey.hu/arch/2004/
165 baz get lorentey@elte.hu--2004/emacs--multi-tty <directory>
167 This is "instantly" updated, but very slow from outside Hungary.
168 (By "instantly" I mean as soon as I connect the notebook I work on to
169 a network. It could take days.)
171 The Arch supermirror provides mirroring services for all public Arch
172 repositories. We have a mirror there, too, if you prefer.
174 baz register-archive -f http://mirrors.sourcecontrol.net/lorentey%40elte.hu--2004
175 baz get lorentey@elte.hu--2004/emacs--multi-tty <directory>
177 My GPG key id is 0FB27A3F; it is available from
178 hkp://wwwkeys.eu.pgp.net/, or from my homepage at
179 http://lorentey.hu/rolam/gpg.html)
181 Don't worry if the above checkout takes a few minutes to complete;
182 once you have a source tree, updating it to the latest revision will
183 be _much_ faster. Use the following command for the update:
187 You can find more information about Bazaar on
188 http://bazaar.canonical.com/. It's a distributed source control
189 system that is somewhat less broken than competing projects.
191 If you don't have Bazaar, the branch has a homepage from which you can
192 download conventional patches against Emacs CVS HEAD:
194 http://lorentey.hu/project/emacs.html
196 I suggest you use Bazaar whenever feasible.
202 If you run Debian, or a distribution based on Debian, you are welcome
203 to use our binary packages; put these lines in your /etc/apt/sources.list:
206 deb http://aszt.inf.elte.hu/~lorentey/mirror/apt unstable multi-tty
207 deb-src http://aszt.inf.elte.hu/~lorentey/mirror/apt unstable multi-tty
209 Note that these packages are intended solely to provide an easy way to
210 test the new multi-tty features. They are not to be taken as Emacs
211 releases, and it's a mistake to expect robust operation or any kind of
212 timely support for them. Do not install them, unless you'd like to
213 have your editor crash on you.
219 The multi-tty branch is compiled the same way as Emacs itself:
221 make maintainer-clean # (If you have compiled Emacs before)
223 ./configure --without-gtk <your favourite options>
227 If you have strange compilation errors, they may be caused by old
228 *.elc files that are left over from an earlier bootstrap. The `make
229 maintainer-clean' target deletes them, so it is a good idea to run
230 that before reporting a bug. (Emacs requires a clean recompilation
231 after certain kinds of source code changes.)
236 To test the multi-tty branch, start up the Emacs server with the
242 and then (from a shell prompt on another terminal) start emacsclient
244 emacsclient -t /optional/file/names... (for a tty frame)
245 emacsclient /optional/file/names... (for an X frame)
247 (Make sure both emacs and emacsclient are multi-tty versions.)
248 You'll hopefully have two fully working, independent frames on
249 separate terminals. The new frame is closed automatically when you
250 finish editing the specified files (C-x #), but delete-frame (C-x 5 0)
251 also works. Of course, you can create frames on more than two tty
254 Creating new frames on the same tty with C-x 5 2 (make-frame-command)
255 works, and behaves the same way as in previous Emacs versions. If you
256 exit emacs, all terminals should be restored to their previous states.
258 This is work in progress, and probably full of bugs. It is a good
259 idea to run emacs from gdb, so that you'll have a live instance to
260 debug if something goes wrong. Please send me your bug reports on our
261 mailing list: multi-tty@lists.fnord.hu
266 I think the best way to use the new Emacs is to have it running inside
267 a disconnected GNU screen session, and always use emacsclient for
268 normal work. One advantage of this is that not a single keystroke of
269 your work will be lost if the display device that you are using
270 crashes, or the network connection times out, or whatever. (I had an
271 extremely unstable X server for some time while I was developing these
272 patches, and running Emacs this way has saved me a number of M-x
273 recover-session invocations.)
275 I use the following two bash scripts to handle my Emacs sessions:
277 -------------------------------------------------------connect-emacs--
279 # Usage: connect-emacs <name> <args>...
281 # Connects to the Emacs instance called NAME. Starts up the instance
282 # if it is not already running. The rest of the arguments are passed
288 if [ -z "$name" ]; then
289 echo "Usage: connect_emacs <name> <args>..." >&2
292 preload-emacs "$name" wait
293 /usr/bin/emacsclient.emacs-multi-tty -s "$name" "$@"
294 ----------------------------------------------------------------------
296 -------------------------------------------------------preload-emacs--
298 # Usage: preload-emacs <name> [<waitp>]
300 # Preloads the Emacs instance called NAME in a detached screen
301 # session. Does nothing if the instance is already running. If WAITP
302 # is non-empty, the function waits until the server starts up and
303 # creates its socket; otherwise it returns immediately.
307 screendir="/var/run/screen/S-$USER"
308 serverdir="/tmp/emacs$UID"
309 emacs=/usr/bin/emacs-multi-tty # Or wherever you installed your multi-tty Emacs
311 if [ -z "$name" ]; then
312 echo "Usage: preload_emacs <name> [<waitp>]" >&2
316 if [ ! -e "$screendir"/*."$name" ]; then
317 if [ -e "$serverdir/$name" ]; then
318 # Delete leftover socket (for the wait option)
319 rm "$serverdir/$name"
321 screen -dmS "$name" "$emacs" -nw --eval "(setq server-name \"$name\")" -f server-start
323 if [ ! -z "$waitp" ]; then
324 while [ ! -e "$serverdir/$name" ]; do sleep 0.1; done
326 ----------------------------------------------------------------------
328 I have the following in my profile to have two instances automatically
329 preloaded for editing and email:
334 It is useful to set up short aliases for connect-emacs. I use the
337 alias edit="connect-emacs editor"
339 alias et="connect-emacs editor -t"
340 alias gnus="connect-emacs gnus"
352 For the NEWS file: (Needs much, much work)
354 ** Support for multiple terminal devices and simultaneous graphical
355 and tty frames has been added. You can test for the presence of
356 this feature in your Lisp code by testing for the `multi-tty'
359 *** The `window-system' variable has been made frame-local. The new
360 `initial-window-system' variable contains the `window-system'
361 value for the first frame.
363 *** You can specify a terminal device (`tty' parameter) and a terminal
364 type (`tty-type' parameter) to `make-terminal-frame'.
366 *** The new function `make-frame-on-tty' allows you to create a new
367 frame on another tty device interactively.
369 *** The function `make-frame-on-display' now works during a tty
370 session, and `make-frame-on-tty' works during a graphical session.
372 *** Emacsclient has been extended to support opening a new terminal
373 frame. Its behaviour has been changed to open a new Emacs frame by
374 default. Use the -c option to get the old behavior of opening
375 files in the currently selected Emacs frame.
377 *** C-z now invokes `suspend-frame', C-x C-c now invokes
378 `save-buffers-kill-terminal'.
380 *** New functions: frame-tty-name, frame-tty-type, delete-tty,
381 suspend-tty, resume-tty, terminal-id, terminal-parameters,
382 terminal-parameter, set-terminal-parameter,
383 modify-terminal-parameters, environment, let-environment
385 *** New variables: local-key-translation-map, local-function-key-map
387 *** The `keyboard-translate-table' variable and the terminal and
388 keyboard coding systems have been made terminal-local.
390 *** In addition to the global key-translation-map and
391 function-key-map, Emacs has terminal-local
392 local-key-translation-map and local-function-key-map variables,
393 and uses them instead of the global keymaps to set up translations
394 and function key sequences relevant to a specific terminal device.
396 *** talk.el has been extended for multiple tty support.
400 (The rest of this file consists of my development notes and as such it
401 is probably not very interesting for anyone else.)
406 ** emacsclient -t on the console does not work after su:
410 *ERROR*: Could not open file: /dev/tty1
412 The tty can be opened as /dev/tty by emacsclient, but not by Emacs.
413 This seems to be a serious problem. Currently my only idea is to
414 bring back the ugly pty proxy hack from the initial versions of
415 multi-tty. Suggestions would be appreciated.
417 ** Understand how `quit_throw_to_read_char' works, and fix any bugs
420 ** See if getcjmp can be eliminated somehow. Why does Emacs allow
421 asynchronous input processing while it's reading input anyway?
423 ** `delete-frame' events are handled by `special-event-map'
424 immediately when read by `read_char'. This is fine but it prevents
425 higher-level keymaps from binding that event to get notified of the
428 Sometimes it would be useful for Lisp code to be notified of frame
429 deletions after they have happened, usually because they want to
430 clean up after the deleted frame. Not all frame-local states can
431 be stored as a frame parameter. For example,
432 `display-splash-screen' uses `recursive-edit' with a special keymap
433 override to create its buffer---and it leads to all kinds of
434 nastiness if Emacs stays in this recursive edit mode after the
435 frame containing the splash screen is deleted. Basically, the
436 splash-screen implementation wants to throw out of the recursive
437 edit when the frame is deleted; however, it is not legal to throw
438 from `delete-frame-functions' because `delete-frame' must not fail.
439 (Introducing `delete-frame-after-functions' would not help either
440 because `delete-frame' may not fail at that time either.)
442 Currently `fancy-splash-screens' installs a
443 `delete-frame-functions' hook that sets up a timer to exit the
444 recursive edit. This is an adequate solution, but it would perhaps
445 be better to have something like a `frame-deleted' event that could
446 be bound in the normal way.
448 ** Trouble: `setenv' doesn't actually set environment variables in the
449 Emacs process. This defeats the purpose of the elaborate
450 `server-with-environment' magic around the `tgetent' call in
453 ** (Possibly) create hooks in struct device for creating frames on a
454 specific terminal, and eliminate the hackish terminal-related frame
455 parameters (display, tty, tty-type).
460 ** Decide whether to keep the C implementation of terminal parameters,
461 or revert to the previous, purely Lisp code. It turned out that
462 local environments do not need terminal parameters after all.
464 ** Move Fsend_string_to_terminal to term.c, and declare get_named_tty
465 as static, removing it from dispextern.h.
466 Move fatal to emacs.c and declare it somewhere.
468 ** Search for `suspend-emacs' references and replace them with
469 `suspend-frame', if necessary. Ditto for `save-buffers-kill-emacs'
470 vs. `save-buffers-kill-display'.
472 ** Emacs crashes when a tty frame is resized so that there is no space
473 for all its windows. (Tom Schutzer-Weissmann)
475 ** Report GTK multi-display problems to GTK maintainers. For extra
478 Currently you can not connect to new X displays when you compile
479 Emacs with GTK support. If you want to play around with GTK
480 multidisplay (and don't mind core dumps), you can edit src/config.h
481 and define HAVE_GTK_MULTIDISPLAY there by hand.
483 http://bugzilla.gnome.org/show_bug.cgi?id=85715
485 Update: Han reports that GTK+ version 2.8.9 almost gets display
486 disconnects right. GTK will probably be fully fixed by the time
487 multi-tty gets into the trunk.
489 Update: I am still having problems with GTK+ 2.8.10. I have the
490 impression that the various multidisplay fixes will only get
491 released in GTK+ 2.10.
493 ** Audit `face-valid-attribute-values' usage in customize and
494 elsewhere. Its return value depends on the current window system.
495 Replace static initializers using it with runtime functions. For
496 example, custom's buttons are broken on non-initial device types.
498 ** Possibly turn off the double C-g feature when there is an X frame.
499 C.f. (emacs)Emergency Escape.
501 ** frames-on-display-list should also accept frames.
503 ** Consider the `tty-type' frame parameter and the `display-tty-type'
504 function. They serve the exact same purpose. I think it may be
505 a good idea to eliminate one of them, preferably `tty-type'.
507 ** The handling of lisp/term/*.el, and frame creation in general, is a
508 big, big mess. How come the terminal-specific file is loaded by
509 tty-create-frame-with-faces? I don't think it is necessary to load
510 these files for each frame; once per terminal should be enough.
511 Update: lisp/term/*.el is not loaded repeatedly anymore, but
512 faces.el still needs to be cleaned up.
514 ** Fix frame-set-background-mode in this branch. It was recently
515 changed in CVS, and frame.el in multi-tty has not yet been adapted
516 for the changes. (It needs to look at
517 default-frame-background-mode.) (Update: maybe it is fixed now;
518 needs testing.) (Note that the byte compiler has this to say about
521 term/rxvt.el:309:17:Warning: assignment to free variable
522 `default-frame-background-mode'
524 ** I think `(set-)terminal-local-value' and the terminal parameter
525 mechanism should be integrated into a single framework.
527 (Update: `(set-)terminal-local-value' is now eliminated, but the
528 terminal-local variables should still be accessible as terminal
529 parameters. This also applies to `display-name' and similar
532 ** Add the following hooks: after-delete-frame-hook (for server.el,
533 instead of delete-frame-functions),
534 after-delete-terminal-functions, after-create-terminal-functions.
536 ** BULK RENAME: The `display-' prefix of new Lisp-level functions
537 conflicts with stuff like `display-time-mode'. Use `device-'
538 or `terminal-' instead. I think I prefer `terminal-'.
540 It turns out that most of the offending Lisp functions were defined
541 in the trunk. Therefore, compatibility aliases should be defined
542 for the following names:
544 display-color-cells terminal-color-cells
545 display-color-p terminal-color-p
546 display-graphic-p terminal-graphic-p
547 display-grayscale-p terminal-grayscale-p
548 display-images-p terminal-images-p
549 display-mm-height terminal-mm-height
550 display-mm-width terminal-mm-width
551 display-mouse-p terminal-mouse-p
552 display-multi-font-p terminal-multi-font-p
553 display-multi-frame-p terminal-multi-frame-p
554 display-pixel-height terminal-pixel-height
555 display-pixel-width terminal-pixel-width
556 display-pixels-per-inch terminal-pixels-per-inch
557 display-planes terminal-planes
558 display-popup-menus-p terminal-popup-menus-p
559 display-save-under terminal-save-under
560 display-screens terminal-screens
561 display-supports-face-attributes-p terminal-supports-face-attributes-p
562 display-visual-class terminal-visual-class
563 framep-on-display framep-on-terminal
564 frames-on-display-list frames-on-terminal-list
566 The following functions were introduced in the multi-tty branch, and
567 were renamed without aliases:
569 delete-display delete-terminal
570 display-controlling-tty-p controlling-tty-p
571 display-list terminal-list
572 display-live-p terminal-live-p
573 display-name terminal-name
574 display-tty-type tty-type
575 frame-display frame-terminal
576 selected-display selected-terminal
578 ** The single-keyboard mode of MULTI_KBOARD is extremely confusing
579 sometimes; Emacs does not respond to stimuli from other keyboards.
580 At least a beep or a message would be important, if the single-mode
581 is still required to prevent interference. (Reported by Dan
584 Update: selecting a region with the mouse enables single_kboard
585 under X. This is very confusing.
587 Update: After discussions with Richard Stallman, this will be
588 resolved by having locked displays warn the user to wait, and
589 introducing a complex protocol to remotely bail out of
590 single-kboard mode by pressing C-g.
592 Update: Warning the user is not trivial to implement, as Emacs has
593 only one echo area, shared by all frames. Ideally the warning
594 should not be displayed on the display that is locking the others.
595 Perhaps the high probability of user confusion caused by
596 single_kboard mode deserves a special case in the display code.
597 Alternatively, it might be good enough to signal single_kboard mode
598 by changing the modelines or some other frame-local display element
599 on the locked out displays.
601 Update: In fact struct kboard does have an echo_string slot.
603 ** The session management module is prone to crashes when the X
604 connection is closed and then later I try to connect to a new X
607 #0 0xb7ebc806 in SmcGetIceConnection () from /usr/X11R6/lib/libSM.so.6
608 #1 0x080e6641 in x_session_check_input (bufp=0xbf86c9c0) at xsmfns.c:144
609 #2 0x080d3bbc in XTread_socket (device=0xa722ff8, expected=1, hold_quit=0xbf86ca90) at xterm.c:7037
610 #3 0x080fa404 in read_avail_input (expected=1) at keyboard.c:6696
611 #4 0x080fa4ca in handle_async_input () at keyboard.c:6900
612 #5 0x080d51fa in x_term_init (display_name=162628899, xrm_option=0x0, resource_name=0x857068c "emacs") at xterm.c:10622
613 #6 0x080d920e in x_display_info_for_name (name=162628899) at xfns.c:3975
614 #7 0x080d92f9 in check_x_display_info (object=1) at xfns.c:274
615 #8 0x080d97b8 in Fx_create_frame (parms=151221485) at xfns.c:3016
616 #9 0x0815bf72 in Ffuncall (nargs=2, args=0xbf86ceec) at eval.c:2851
618 I installed a workaround to prevent this. The X session manager is
619 only contacted when the very first display in the Emacs session is
620 an X display. Also, x_delete_display() on this display aborts
621 session management, and XTread_socket only calls
622 x_session_check_input when it is called for the display that the
623 session was opened on. While this does not really fix the bug, it
624 makes it much less frequent, because session manager support will
625 not normally be enabled when Emacs can survive the shutdown of the
628 See if xsmfns.c should be updated.
630 ** Hunt down display-related functions in frame.el and extend them all
631 to accept display ids.
633 ** rif->flush_display_optional (NULL) calls should be replaced by a
636 ** The set-locale-environment hack (adding the DISPLAY option) should
637 be replaced with a clean design.
639 ** standard-display-table should be display-local.
640 standard-display-european should be display-local.
642 ** With iswitchb-default-method set to 'always-frame, only frames on
643 the current display should be considered. This might involve
644 extending `get-buffer-window'.
646 ** Have a look at Vlocale_coding_system. Seems like it would be a
647 tedious job to localize it, although most references use it for
648 interfacing with libc and are therefore OK with the global
651 Exceptions found so far: x-select-text and
652 x-cut-buffer-or-selection-value.
654 ** Have a look at fatal_error_hook.
656 ** Have a look at set_frame_matrix_frame.
658 ** Check if we got term-setup-hook right.
660 ** I think tip_frame should be display-local.
662 ** Check display reference count handling in x_create_tip_frame.
664 ** make-frame does not correctly handle extra parameters in its
667 (frame-parameter (make-frame (list (cons 'foobar 42))) 'foobar)
670 (This is likely an error in the CVS trunk.)
672 ** Dan Nicolaescu suggests that -nw should be added as an alias for -t
673 in emacsclient. Good idea. (Alas, implementing this is not
674 trivial, getopt_long does not seem to support two-letter ``short''
675 options. Patches are welcome.)
677 ** Mark Plaksin suggests that emacsclient should accept the same
678 X-related command-line arguments as Emacs. Most of the X-related
679 argument-handling is done in Lisp, so this should be quite easy to
682 ** Gergely Nagy suggests that C-x # should only kill the current
683 frame, not any other emacsclient frame that may have the same file
684 opened for editing. I think I agree with him.
686 ** Very strange bug: visible-bell does not work on secondary
687 terminals in xterm and konsole. The screen does flicker a bit,
688 but it's so quick it isn't noticable.
690 (Update: This is probably some problem with padding or whatnot on
691 the secondary terminals.)
693 ** Move baud_rate to struct display.
695 ** Implement support for starting an interactive Emacs session without
696 an initial frame. (The user would connect to it and open frames
697 later, with emacsclient.)
699 ** Fix Mac support (I can't do this entirely myself). Note that the
700 current state of Mac-specific source files in the multi-tty tree
701 are not useful; before starting work on Mac support, revert to
702 pristine, pre-multi-tty versions.
704 ** Fix W32 support (I can't do this entirely myself). Note that the
705 current state of W32-specific source files in the multi-tty tree
706 are not useful; before starting work on W32 support, revert to
707 pristine, pre-multi-tty versions.
709 ** Fix DOS support (I can't do this entirely myself). Note that the
710 current state of DOS-specific source files in the multi-tty tree
711 are not useful; before starting work on DOS support, revert to
712 pristine, pre-multi-tty versions.
714 ** Do a grep on XXX and ?? for more issues.
716 ** flow-ctrl.el must be updated.
718 ** Fix stuff_char for multi-tty. Doesn't seem to be of high priority.
723 (ex-TODO items with explanations.)
725 -- Introduce a new struct for terminal devices.
727 (Done, see struct tty_output. The list of members is not yet
730 -- Change the bootstrap procedure to initialize tty_list.
732 (Done, but needs review.)
734 -- Change make-terminal-frame to support specifying another tty.
736 (Done, new frame parameters: `tty' and `tty-type'.)
738 -- Implement support for reading from multiple terminals.
740 (Done, read_avail_input tries to read from each terminal, until one
741 succeeds. MULTI_KBOARD is not used. Secondary terminals don't send
744 (Update: They do, now.)
746 (Update2: After enabling X, they don't.)
748 -- other-frame should cycle through the frames on the `current'
751 (Done, by trivially modifiying next_frame and prev_frame.)
753 -- Support different terminal sizes.
757 -- Make sure terminal resizes are handled gracefully. (Could be
760 (Done. We don't get automatic SIGWINCH for additional ttys,
763 -- Extend emacsclient to automatically open a new tty when it connects
766 (Done. It's an ugly hack, needs more work.)
768 -- Redisplay must refresh the topmost frame on *all* terminals, not
769 just the initial terminal.
771 (Done, but introduced an ugly redisplay problems. Ugh.)
773 -- Fix redisplay problems.
775 (Done; it turned out that the entire Wcm structure must be moved
776 inside tty_output. Why didn't I catch this earlier?)
778 -- Provide a way for emacsclient to tell Emacs that the tty has been
781 (Done, simply forward the SIGWINCH signal.)
783 -- Each keypress should automatically select the frame corresponding
784 to the terminal that it was coming from. This means that Emacs
785 must know from which terminal the last keyboard event came from.
787 (Done, it was quite simple, the input event system already
788 supported multiple frames.)
790 -- Fix SIGIO issue with secondary terminals.
792 (Done, emacsclient signals Emacs after writing to the proxy pseudo
793 terminal. Note that this means that multi-tty does not work with
796 (Update: This is bullshit. There is a read_input_waiting function,
797 extend that somehow.)
799 (Update of update: The first update was not right either, extending
800 read_input_waiting was not necessary. Secondary ttys do seem to
801 send signals on input.)
803 (Update^3: Not any more.)
805 -- Make make-terminal-frame look up the `tty' and `tty-type' frame
806 parameters from the currently selected terminal before the global
811 -- Put all cached terminal escape sequences into struct tty_output.
812 Currently, they are still stored in global variables, so we don't
813 really support multiple terminal types.
815 (Done. It was not fun.)
817 -- Implement sane error handling after initialization. (Currently
818 emacs exits if you specify a bad terminal type.) The helpful error
819 messages must still be provided when Emacs starts.
823 -- Implement terminal deletion, i.e., deleting local frames, closing
824 the tty device and restoring its previous state without exiting
827 (Done, but at the moment only called when an error happens during
828 initialization. There is a memory corruption error around this
829 somewhere.) (Update: now it is fully enabled.)
831 -- Implement automatic deletion of terminals when the last frame on
832 that terminal is closed.
836 -- Restore tty screen after closing the terminal.
838 (Done, we do the same as Emacs 21.2 for all terminals.)
840 -- 'TERM=dumb src/emacs' does not restore the terminal state.
844 -- C-g should work on secondary terminals.
846 (Done, but the binding is not configurable.)
848 -- Deal with SIGHUP in Emacs and in emacsclient. (After this, the
849 server-frames may be removed from server.el.)
851 (Done, nothing to do. It seems that Emacs does not receive SIGHUP
852 from secondary ttys, which is actually a good thing.) (Update: I
853 think it would be a bad idea to remove server-frames.)
855 -- Change emacsclient/server.el to support the -t argument better,
856 i.e. automatically close the socket when the frame is closed.
858 (Seems to be working OK.)
860 -- Fix mysterious memory corruption error with tty deletion. To
861 trigger it, try the following shell command:
863 while true; do TERM=no-such-terminal-definition emacsclient -h; done
865 Emacs usually dumps core after a few dozen iterations. (The bug
866 seems to be related to the xfreeing or bzeroing of
867 tty_output.Wcm. Maybe there are outside references to struct Wcm?
868 Why were these vars collected into a struct before multi-tty
871 (Done. Whew. It turned out that the problem had nothing to do
872 with hypothetical external references to Wcm, or any other
873 tty_output component; it was simply that delete_tty closed the
874 filehandles of secondary ttys twice, resulting in fclose doubly
875 freeing memory. Utterly trivial matter. I love the C's memory
876 management, it puts hair on your chest.)
878 -- Support raw secondary terminals. (Note that SIGIO works only on
879 the controlling terminal.) Hint: extend read_input_waiting for
880 multiple ttys and hopefully this will be fixed.
882 (Done, it seems to have been working already for some time. It
883 seems F_SETOWN does work, after all. Not sure what made it fail
884 earlier, but it seems to be fixed (there were several changes
885 around request_sigio, maybe one of them did it).
886 read_input_waiting is only used in sys_select, don't change
887 it.) (Update: After adding X support, it's broken again.)
888 (Update^2: No it isn't.) :-)
890 -- Find out why does Emacs abort when it wants to close its
891 controlling tty. Hint: chan_process[] array. Hey, maybe
892 noninterrupt-IO would work, too? Update: no, there is no process
895 (Done. Added add/delete_keyboard_wait_descriptor to
896 term_init/delete_tty. The hint was right, in a way.)
898 -- Issue with SIGIO: it needs to be disabled during redisplay. See if
899 fcntl kernel behaviour could be emulated by emacsclient.
901 (Done. Simply disabled the SIGIO emulation hack in emacsclient.)
902 (Update: it was added back.) (Update^2: and removed again.)
904 -- server.el: There are issues with saving files in buffers of closed
905 clients. Try editing a file with emacsclient -f, and (without
906 saving it) do a delete-frame. The frame is closed without
907 question, and a surprising confirmation prompt appears in another
910 (Done. delete-frame now asks for confirmation if it still has
911 pending buffers, and modified buffers don't seem to be deleted.)
913 -- emacsclient.el, server.el: Handle eval or file open errors when
918 -- Make parts of struct tty_output accessible from Lisp. The device
919 name and the type is sufficient.
921 (Done, see frame-tty-name and frame-tty-type.)
923 -- Export delete_tty to the Lisp environment, for emacsclient.
925 (Done, see delete-tty.)
927 -- Get rid of the accessor macros in termchar.h, or define macros for
932 -- Move device-specific parameters (like costs) commonly used by
933 device backends to a common, device-dependent structure.
935 (Done. See struct display_method in termhooks.h.)
939 (Done. Well, it seems to be working.)
941 -- Allow simultaneous X and tty frames. (Handling input could be
942 tricky. Or maybe not.)
944 (Done. Allowed, that is. It is currently extremely unstable, to
945 the point of being unusable. The rif variable causes constant
946 core dumps. Handling input is indeed tricky.)
948 -- Rewrite multi-tty input in terms of MULTI_KBOARD.
950 (Done. In fact, there was no need to rewrite anything, I just
951 added a kboard member to tty_display_info, and initialized the
952 frame's kboard from there.)
954 -- Fix rif issue with X-tty combo sessions. IMHO the best thing to do
955 is to get rid of that global variable (and use the value value in
956 display_method, which is guaranteed to be correct).
958 (Done, did exactly that. Core dumps during combo sessions became
959 much rarer. In fact, I have not yet met a single one.)
961 -- Add multi-tty support to talk.el.
965 -- Clean up the source of emacsclient. It is a mess.
967 (Done, eliminated stupid proxy-pty kludge.)
969 -- Fix faces on tty frames during X-tty combo sessions. There is an
970 init_frame_faces call in init_sys_modes, see if there is a problem
973 (Done, there was a stupid mistake in
974 Ftty_supports_face_attributes_p. Colors are broken, though.)
976 -- C-x 5 2, C-x 5 o, C-x 5 0 on an emacsclient frame unexpectedly
977 exits emacsclient. This is a result of trying to be clever with
978 delete-frame-functions.
980 (Fixed, added delete-tty-after-functions, and changed server.el to
983 -- Something with (maybe) multi-keyboard support broke function keys
984 and arrows on ttys during X+tty combo sessions. Debug this.
986 (I can't reproduce it, maybe the terminal type was wrong.)
988 -- Fix input from raw ttys (again).
990 (Now it seems to work all right.)
992 -- During an X-tty combo session, a (message "Hello") from a tty frame
993 goes to the X frame. Fix this.
995 (Done. There was a safeguard against writing to the initial
996 terminal frame during bootstrap which prevented echo_area_display
997 from working correctly on a tty frame during a combo session.)
999 -- If there are no frames on its controlling terminal, Emacs should
1000 exit if the user presses C-c there.
1002 (Done, as far as possible. See the SIGTERM comment in
1003 interrupt_signal on why this seems to be impossible to solve this
1006 -- During an X session, Emacs seems to read from stdin. Also, Emacs
1007 fails to start without a controlling tty.
1009 (Fixed by replacing the troublesome termcap display with a dummy
1010 bootstrap display during bootstrap.
1012 -- Do tty output through struct display, like graphical display
1017 -- Define an output_initial value for output_method for the initial
1018 frame that is dumped with Emacs. Checking for this frame (e.g. in
1019 cmd_error_internal) is ugly.
1021 (Done, breaking interactive temacs.)
1023 -- The command `emacsclient -t -e '(delete-frame)'' fails to exit.
1027 -- frame-creation-function should always create a frame that is on the
1028 same display as the selected frame. Maybe frame-creation-function
1029 should simply be removed and make-frame changed to do the right
1032 (Done, with a nice hack. frame-creation-function is now frame-local.)
1034 -- Fix C-g on raw ttys.
1036 (Done. I disabled the interrupt/quit keys on all secondary
1037 terminals, so Emacs sees C-g as normal input. This looks like an
1038 overkill, because emacsclient has extra code to pass SIGINT to
1039 Emacs, so C-g should remain the interrupt/quit key on emacsclient
1040 frames. See the next entry why implementing this distinction would
1043 -- Make sure C-g goes to the right frame with ttys. This is hard, as
1044 SIGINT doesn't have a tty parameter. :-(
1046 (Done, the previous change fixes this as a pleasant side effect.)
1048 -- I have seen a case when Emacs with multiple ttys fell into a loop
1049 eating 100% of CPU time. Strace showed this loop:
1052 kill(30284, SIGIO) = 0
1053 --- SIGIO (I/O possible) @ 0 (0) ---
1054 ioctl(6, FIONREAD, [0]) = -1 EIO (Input/output error)
1055 ioctl(5, FIONREAD, [0]) = -1 EIO (Input/output error)
1056 ioctl(0, FIONREAD, [0]) = 0
1057 sigreturn() = ? (mask now [])
1058 gettimeofday({1072842297, 747760}, NULL) = 0
1059 gettimeofday({1072842297, 747806}, NULL) = 0
1060 select(9, [0 3 5 6], NULL, NULL, {0, 0}) = 2 (in [5 6], left {0, 0})
1061 select(9, [0 3 5 6], NULL, NULL, {0, 0}) = 2 (in [5 6], left {0, 0})
1062 gettimeofday({1072842297, 748245}, NULL) = 0
1064 I have seen something similar with a single X frame, but have not
1065 been able to reproduce it for debugging.
1067 Update: This may have been caused by checking for nread != 0
1068 instead of nread > 0 after calling read_socket_hook in
1071 (Fixed. This was caused by unconditionally including stdin in
1072 input_wait_mask in init_process. The select call in
1073 wait_reading_process_input always returned immediately, indicating
1074 that there is pending input from stdin, which nobody read.
1076 Note that the above strace output seems to be an unrelated but
1077 similar bug. I think that is now fixed.)
1079 -- Exiting Emacs while there are emacsclient frames doesn't restore the
1080 ttys to their default states.
1082 (This seems to be fixed by some previous change.)
1084 -- Allow opening an X session after -nw.
1088 -- Fix color handling during tty+X combo sessions. (It seems that tty
1089 sessions automatically convert the face colors to terminal colors
1090 when the face is loaded. This conversion must happen instead on
1091 the fly in write_glyphs, which might be problematic, as color
1092 approximation is currently done in lisp (term/tty-colors.el).)
1093 (Update: hm, colors seem to work fine if I start emacs with -nw and
1094 then create an X frame. Maybe it's just a small buglet somewhere.)
1096 (Seems to be fixed. The problem was in startup.el, it did not
1097 initialize tty colors when the initial window system was
1100 -- emacs -nw --eval '(y-or-n-p "Foobar")' segfaults. (Reported by
1103 (Fixed, there was a keyboard initialization problem.)
1105 -- Fix interactive use of temacs. There are face-related SEGVs, most
1106 likely because of changes in realize_default_face, realize_face.
1110 -- Don't exit Emacs when the last X connection fails during a
1111 multi-display session.
1115 -- Dan Nicolaescu noticed that starting emacsclient on the same
1116 terminal device that is the controlling tty of the Emacs process
1117 gives unexpected results.
1121 -- Istvan Marko reported that Emacs hang on ttys if it was started
1122 from a shell script.
1124 (Fixed. There was a bug in the multi-tty version of
1125 narrow_foreground_group. tcsetpgrp blocks if it is called from a
1126 process that is not in the same process group as the tty.)
1128 -- emacsclient -t from an Emacs term buffer does not work, complains
1129 about face problems. This can even lock up Emacs (if the recursive
1130 frame sets single_kboard). Update: the face problems are caused by
1131 bugs in term.el, not in multi-tty. The lockup is caused by
1132 single_kboard mode, and is not easily resolvable. The best thing to
1133 do is to simply refuse to create a tty frame of type `eterm'.
1135 (Fixed, changed emacsclient to check for TERM=eterm. The face
1136 complaints seem to be caused by bugs in term.el; they are not
1137 related to multi-tty.)
1139 -- Find out the best way to support suspending Emacs with multiple
1140 ttys. My guess: disable it on the controlling tty, but from other
1141 ttys pass it on to emacsclient somehow. (It is (I hope) trivial to
1142 extend emacsclient to handle suspend/resume. A `kill -STOP' almost
1145 (Done. I needed to play with signal handling and the server
1146 protocol a bit to make emacsclient behave as a normal UNIX program
1147 wrt foreground/background process groups.)
1149 -- There is a flicker during the startup of `emacs -nw'; it's as if
1150 the terminal is initialized, reset and then initialialized again.
1151 Debug this. (Hint: narrow_foreground_group is called twice during
1156 -- Robert Chassell has found serious copy-paste bugs with the
1157 multi-tty branch. There seem to be redisplay bugs while copying
1158 from X to a terminal frame. Copying accented characters do not
1161 (Patch-124 should fix this, by changing the interprogram-*-function
1162 variables to be frame-local, as suggested by Mark Plaksin
1163 (thanks!). I think that the redisplay bugs are in fact not bugs,
1164 but delays caused by single_kboard --> perhaps MULTI_KBOARD should
1167 -- frame-creation-function was removed, which might be a bad idea.
1168 Think up a compatible solution.
1170 (It was an internal interface that may be changed when necessary.)
1172 -- Change Lisp code not to (getenv "TERM"); use the `tty-type' frame
1173 parameter or the frame-tty-type function instead. (M-x tags-search
1174 "TERM" helps with this.) Update: Actually, all getenv invocations
1175 should be checked for multi-tty compatibility, and an interface
1176 must be implemented to get the remote client's environment.
1178 (Done. Only getenv calls in lisp/term/*.el were changed; other
1179 calls should be mostly left as they are.)
1181 -- Add an elaborate mechanism for display-local variables. (There are
1182 already a few of these; search for `terminal-local' in the Elisp
1185 (Not needed. Display-local variables could be emulated by
1186 frame-local variables.)
1188 -- Emacs assumes that all terminal frames have the same locale
1189 settings as Emacs itself. This may lead to bogus results in a
1190 multi-locale setup. (E.g., while logging in from a remote client
1191 with a different locale.)
1192 (Update after new bugreport by Friedrich Delgado Friedrichs:
1193 (at least) the structs terminal_coding and keyboard_coding in
1194 coding.c must be moved to struct display, and the Lisp interface
1195 [set-]keyboard-coding-system must be adapted for the change.)
1197 (Fixed. Emacs now uses the locale settings as seen by the
1198 emacsclient process for server tty frames.)
1199 (Update: Not really; Vlocale_coding_system is still global.)
1201 -- Make `struct display' accessible to Lisp programs. Accessor functions:
1203 (displayp OBJECT): Returns t if OBJECT is a display.
1204 => Implemented as display-live-p.
1206 (display-list): Returns list of currently active displays.
1209 (selected-display): Returns the display object of the selected frame.
1210 => Not strictly necessary, but implemented anyway.
1212 (frame-display FRAME): Returns the display object of FRAME.
1215 (display-frames DISPLAY): Returns a list of frames on DISPLAY.
1216 => Already implemented, see frames-on-display-list.
1218 (display-type DISPLAY): Returns the type of DISPLAY, as a
1219 symbol. (See `framep'.)
1220 => Implemented as display-live-p.
1222 (display-device DISPLAY): Returns the name of the device that
1223 DISPLAY uses, as a string. (E.g: "/dev/pts/16", or
1225 => Implemented as display-name.
1229 See next issue why this is necessary.
1231 (Update: The consensus on emacs-devel seems to be to do this via
1232 integer identifiers. That's fine by me.)
1236 -- The following needs to be supported:
1243 The cleanest way to solve this is to allow multiple displays on the
1244 same terminal device; each new emacsclient process should create
1245 its own display. As displays are currently identified by their
1246 device names, this is not possible until struct display becomes
1247 accessible as a Lisp-level object.
1251 -- Miles Bader suggests that C-x C-c on an emacsclient frame should
1252 only close the frame, not exit the entire Emacs session. Update:
1253 see above for a function that does this. Maybe this should be the
1256 (Done. This is the new default. No complaints so far.)
1258 -- Clean up the frame-local variable system. I think it's ugly and
1259 error-prone. But maybe I just haven't yet fully understood it.
1261 (Nothing to do. It doesn't seem ugly any more. It's rather clever.)
1263 -- Support multiple character locales. A version of
1264 `set-locale-environment' needs to be written for setting up
1265 display-local settings on ttys. I think calling
1266 set-display-table-and-terminal-coding-system and
1267 set-keyboard-coding-system would be enough. The language
1268 environment itself should remain a global setting.
1270 (Done, by an ugly hack.)
1272 -- The terminal customization files in term/*.el tend to change global
1273 parameters, which may confuse Emacs with multiple displays. Change
1274 them to tweak only frame-local settings, if possible. (They tend
1275 to call define-key to set function key sequences a lot.)
1277 (Done, by making `function-key-map' terminal-local (i.e., part of
1278 struct kboard). This has probably covered all the remaining problems.)
1280 -- Make `function-key-map' and `key-translation-map' terminal-local.
1284 -- Implement `terminal-local-value' and `set-terminal-local-value' to
1285 allow deterministic access to terminal local bindings. The
1286 encode-kb package can not set up `key-translation-map' without
1287 these. The terminal-local bindings seem to be independent of what
1292 -- xt-mouse.el needs to be adapted for multi-tty. It currently
1293 signals an error on kill-emacs under X, which prevents the user
1294 from exiting Emacs. (Reported by Mnemonikk on freenode.)
1299 -- Having {reset,init}_all_sys_modes in set-input-mode breaks arrow
1300 keys on non-selected terminals under screen, and sometimes on other
1301 terminal types as well. The other function keys continue to work
1302 fine. Sometimes faces on these screens become garbled.
1304 This only seems to affect displays that are of the same terminfo
1305 type as the selected one. Interestingly, in screen Emacs normally
1306 reports the up arrow key as `M-o A', but after the above SNAFU, it
1307 complains about `M-[ a'. UNIX ttys are a complete mystery to me,
1308 but it seems the reset-reinitialize cycle somehow leaves the
1309 non-selected terminals in a different state than usual. I have no
1310 idea how this could happen.
1312 Currently set-input-mode resets only the currently selected
1313 terminal, which seems to somehow work around the problem.
1317 Dan Nicolaescu <dann@ics.uci.edu> writes:
1318 > Some terminals have 2 modes for cursor keys: Application Mode where
1319 > the cursor keys transmit the codes defined in the terminfo entry, and
1320 > Cursor mode. Applications have to send the smkx and rmkx terminfo
1321 > strings to switch between the 2 modes. So Emacs (and emacsclient) have
1322 > to send smkx when initializing and rmkx when quitting (or on
1325 (I think patch-370 fixed this.)
1327 -- This long-standing bug (first reported by Han Boetes) seems to come
1328 and go all the time. It is time to track it down and fix it.
1333 # From another xterm:
1334 emacsclient -e '(y-or-n-p "Do you want me to crash? ")'
1335 # Notice how the answer ends up in the *scratch* buffer
1339 (Fixed in patch-414 after detailed analysis by Kalle Olavi Niemitalo.)
1341 -- normal-erase-is-backspace-mode in simple.el needs to be updated for
1342 multi-tty (rep. by Dan Waber). (The Delete key is broken on X
1345 (Fixed in patch-427.)
1347 -- I think keyboard-translate-table should be made terminal-local.
1349 (Done in patch-431.)
1351 -- The semantics of terminal-local variables are confusing; it is not
1352 clear what binding is in effect in any given time. See if
1353 current_kboard (or at least the terminal-local bindings exported to
1354 Lisp) might be changed to be tied to the selected frame instead.
1355 Currently, `function-key-map' and `key-translation-map' may be
1356 accessed reliably only using the hackish
1357 `(set-)terminal-local-value' functions.
1359 Perhaps there should be a difference between `last-command' &co.
1360 and these more conventional configuration variables.
1361 (E.g. `symbol-value' would use current_kboard to access
1362 `last-command', but SELECTED_FRAME()->display->kboard to get the
1363 value of `function-key-map'.
1365 (Fixed in patch-434.)
1367 -- If the first key pressed on a new tty terminal is a function key,
1368 it is not recognized correctly. May be related to the bug below.
1370 (Seems to have been fixed as a side effect of patch-434. "The bug
1371 below" was the set-input-mode madness.)
1373 (Update: this bug was fixed for good in patch-449. It was tracked
1374 down to a bug in `read_key_sequence': it failed to reinitialize its
1375 local function-key-map/key-translation-map references when it
1376 switched keyboards. I don't understand why did this bug only
1377 appear on brand new frames, though!)
1379 -- Disable connecting to a new X display when we use the GTK toolkit.
1381 (Disabled in patch-450.)
1383 -- Implement automatic forwarding of client environment variables to
1384 forked processes, as discussed on the multi-tty list. Terminal
1385 parameters are now accessible in C code, so the biggest obstacle is
1386 gone. The `getenv_internal' and `child_setup' functions in
1387 callproc.c must be changed to support the following variable:
1389 terminal-local-environment-variables is a variable defined in ...
1391 Enable or disable terminal-local environment variables.
1393 If set to t, `getenv', `setenv' and subprocess creation
1394 functions use the environment variables of the emacsclient
1395 process that created the selected frame, ignoring
1396 `process-environment'.
1398 If set to nil, Emacs uses `process-environment' and ignores
1399 the client environment.
1401 Otherwise, `terminal-local-environment-variables' should be a
1402 list of variable names (represented by Lisp strings) to look
1403 up in the client environment. The rest will come from
1404 `process-environment'.
1406 (Implemented in patch-461; `terminal-getenv', `terminal-setenv' and
1407 `with-terminal-environment' are now replaced by extensions to
1408 `getenv' and `setenv', and the new `local-environment-variables'
1411 (Updated in patch-465 to fix the semantics of let-binding
1412 `process-environment'. `process-environment' was changed to
1413 override all local/global environment variables, and a new variable
1414 `global-environment' was introduced to have `process-environment's
1417 (Updated in patch-466 to fix the case when two emacsclient sessions
1418 share the same terminal, but have different environment. The local
1419 environment lists are now stored as frame parameters, so the
1420 C-level terminal parameters are not strictly necessary any more.)
1422 -- `Fdelete_frame' is called from various critical places where it is
1423 not acceptable for the frame deletion to fail, e.g. from
1424 x_connection_closed after an X error. `Fdelete_frame' now protects
1425 against `delete-frame-functions' throwing an error and preventing a
1426 frame delete. (patch-475)
1428 -- Fix set-input-mode for multi-tty. It's a truly horrible interface;
1429 what if we'd blow it up into several separate functions (with a
1430 compatibility definition)?
1432 (Done. See `set-input-interrupt-mode', `set-output-flow-control',
1433 `set-input-meta-mode' and `set-quit-char'.) (patch-457)
1435 -- Let-binding `overriding-terminal-local-map' on a brand new frame
1436 does not seem to work correctly. (See `fancy-splash-screens'.)
1437 The keymap seems to be set up right, but events go to another
1438 terminal. Or is it `unread-command-events' that gets Emacs
1439 confused? Investigate.
1441 (Emacs was confused because a process filter entered
1442 `recursive-edit' while Emacs was reading input. I added support
1443 for this in the input system.) (patch-489)
1445 -- I smell something funny around pop_kboard's "deleted kboard" case.
1446 Determine what are the circumstances of this case, and fix any
1447 bug that comes to light.
1449 (It happens simply because single_kboard's terminal is sometimes
1450 deleted while executing a command on it, for example the one that
1451 kills the terminal. There was no bug here, but I rewrote the whole
1452 single_kboard mess anyway.) (patch-489)
1454 -- Understand Emacs's low-level input system (it's black magic) :-)
1455 What exactly does interrupt_input do? I tried to disable it for
1456 raw secondary tty support, but it does not seem to do anything
1457 useful. (Update: Look again. X unconditionally enables this, maybe
1458 that's why raw terminal support is broken again. I really do need
1459 to understand input.)
1460 (Update: I am starting to understand the read_key_sequence->read-char
1461 ->kbd_buffer_get_event->read_avail_input->read_socket_hook path. Yay!)
1463 (Update: OK, it all seems so easy now (NOT). Input could be done
1464 synchronously (with wait_reading_process_input), or asynchronously
1465 by SIGIO or polling (SIGALRM). C-g either sets the Vquit_flag,
1466 signals a 'quit condition (when immediate_quit), or throws to
1467 `getcjmp' when Emacs was waiting for input when the C-g event
1470 -- Replace wrong_kboard_jmpbuf with a special return value of
1471 read_char. It is absurd that we use setjmp/longjmp just to return
1472 to the immediate caller.
1474 (Done in patch-500.)
1476 ;;; arch-tag: 8da1619e-2e79-41a8-9ac9-a0485daad17d