diff options
| author | Karoly Lorentey | 2004-01-02 02:54:17 +0000 |
|---|---|---|
| committer | Karoly Lorentey | 2004-01-02 02:54:17 +0000 |
| commit | 7b00d185eba8e01f191a69740e3270c88f88159c (patch) | |
| tree | 1bddf818e98404035261883f3cbfc5e4c80f40bf /README.multi-tty | |
| parent | daf0170133e658c41f3ae2fc8558c5ab74227c1d (diff) | |
| download | emacs-7b00d185eba8e01f191a69740e3270c88f88159c.tar.gz emacs-7b00d185eba8e01f191a69740e3270c88f88159c.zip | |
MULTI_KBOARD support for ttys. Input-related bugfixes for X+tty sessions.
lib-src/emacsclient.c (pty_conversation): Fix errno check for read from fileno(in).
src/config.in: Unconditionally define MULTI_KBOARD.
src/frame.c (make_terminal_frame): Initialize f->kboard.
src/keyboard.c (cmd_error_internal): Don't kill Emacs if a Quit was
pressed on the tty of a X+tty session.
(read_avail_input): Initialize nread to zero. Abort if there is no
tty after a termcap read.
(interrupt_signal)[USG]: Always reset signal handler.
(init_keyboard): Always set signal handler for SIGINT/SIGQUIT if
noninteractive.
src/term.c (term_dummy_init): Initialize kboard to the initial_kboard.
(term_init): Free component structures of the initial tty. Clear xmalloced structures.
Moved rif initialization to syms_of_term.
(term_init)[MULTI_KBOARD]: Initialize tty->kboard.
(delete_tty)[MULTI_KBOARD]: Delete the keyboard.
(syms_of_term): Initialize tty_display_method_template.
src/termchar.h (tty_output)[MULTI_KBOARD]: Added kboard member.
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-31
Diffstat (limited to 'README.multi-tty')
| -rw-r--r-- | README.multi-tty | 223 |
1 files changed, 133 insertions, 90 deletions
diff --git a/README.multi-tty b/README.multi-tty index 96397405ca5..535ed4b3f7f 100644 --- a/README.multi-tty +++ b/README.multi-tty | |||
| @@ -6,6 +6,22 @@ The ultimate goal of this branch is to implement support for opening | |||
| 6 | multiple, different tty devices and simultaneous X and tty frames from | 6 | multiple, different tty devices and simultaneous X and tty frames from |
| 7 | a single Emacs session. | 7 | a single Emacs session. |
| 8 | 8 | ||
| 9 | Some use cases: | ||
| 10 | |||
| 11 | Emacs is notoriously slow at startup, so most people use another | ||
| 12 | editor or emacsclient for quick editing jobs from the console. | ||
| 13 | Unfortunately, emacsclient was very awkward to use, because it did not | ||
| 14 | support opening a new Emacs frame on the current virtual console. | ||
| 15 | Now, with multi-tty support, it can do that. (Emacsclient starts up | ||
| 16 | faster than vi!) | ||
| 17 | |||
| 18 | Some Gnus users (including me) run Gnus in an X frame in its own Emacs | ||
| 19 | instance, which they typically leave running for weeks. It would be | ||
| 20 | nice if they could connect to this instance from a remote ssh session | ||
| 21 | and check their messages without opening a remote X frame or resorting | ||
| 22 | to gnus-slave. | ||
| 23 | |||
| 24 | |||
| 9 | WHO IS DOING IT | 25 | WHO IS DOING IT |
| 10 | --------------- | 26 | --------------- |
| 11 | 27 | ||
| @@ -18,46 +34,66 @@ Retrieving the latest version of the branch: | |||
| 18 | tla register-archive lorentey@elte.hu--2004 http://lorentey.web.elte.hu/arch/2004/ | 34 | tla register-archive lorentey@elte.hu--2004 http://lorentey.web.elte.hu/arch/2004/ |
| 19 | tla get lorentey@elte.hu--2004/emacs--multi-tty <directory> | 35 | tla get lorentey@elte.hu--2004/emacs--multi-tty <directory> |
| 20 | 36 | ||
| 21 | (I use tla 1.1.) | 37 | (I use a recent arch development snapshot, but any of the released |
| 38 | versions of arch will do fine, I think.) | ||
| 39 | |||
| 40 | If you don't have arch, the branch has a homepage from which you can | ||
| 41 | download conventional patches against Emacs CVS HEAD: | ||
| 22 | 42 | ||
| 43 | http://lorentey.web.elte.hu/project/emacs.html | ||
| 23 | 44 | ||
| 24 | STATUS | 45 | STATUS |
| 25 | ------ | 46 | ------ |
| 26 | 47 | ||
| 27 | Basic multi-tty support is there; there are some rough edges, but it | 48 | Multi-tty support is stable, I think most of the problems were fixed. |
| 28 | already seems to be usable. Emacsclient has been extended to support | 49 | (It still needs testing on other architectures, though.) Please let |
| 29 | opening a new terminal frame. | 50 | me know if you find any bugs in it. Emacsclient has been extended to |
| 51 | support opening a new terminal frame. | ||
| 30 | 52 | ||
| 31 | To try it out, compile the multi-tty branch with the following | 53 | To try it out, compile and run the multi-tty branch with the following |
| 32 | commands: | 54 | commands: |
| 33 | 55 | ||
| 34 | mkdir +build | 56 | mkdir +build |
| 35 | cd +build | 57 | cd +build |
| 36 | ../configure | 58 | ../configure |
| 37 | make bootstrap | 59 | make bootstrap |
| 60 | src/emacs -nw | ||
| 61 | M-x server-start | ||
| 38 | 62 | ||
| 39 | then start up the emacs server (src/emacs -nw, M-x server-start), and | 63 | and then (from a shell prompt on another terminal) start emacsclient |
| 40 | then (from a shell prompt on another terminal) start emacsclient with | 64 | with |
| 41 | 65 | ||
| 42 | lib-src/emacsclient -f /optional/file/names... | 66 | lib-src/emacsclient -t /optional/file/names... |
| 43 | 67 | ||
| 44 | You'll hopefully have two fully working, independent frames on | 68 | You'll hopefully have two fully working, independent frames on |
| 45 | separate terminals. (This seems to be very useful, emacsclient starts | 69 | separate terminals. The new frame is closed automatically when you |
| 46 | up even faster than vi!) :-) You can close the newly opened frame and | 70 | have finished editing the specified files (C-x #), but delete-frame |
| 47 | return to the shell without exiting Emacs by pressing C-x 5 0, i.e., | 71 | (C-x 5 0) also works. Of course, you can create frames on more than |
| 48 | delete-frame. Creating new frames on the same tty with C-x 5 2 | 72 | two tty devices. |
| 49 | works exactly as before. Suspending Emacs is disabled at the moment. | ||
| 50 | If you exit emacs, all terminals should be restored to their previous | ||
| 51 | states. | ||
| 52 | 73 | ||
| 53 | X support is (I hope) working, but at the moment there are problems | 74 | Creating new frames on the same tty with C-x 5 2 works, and they |
| 54 | with simultaneous X and tty devices, so don't do that. | 75 | behave the same way as in previous Emacs versions. If you exit emacs, |
| 76 | all terminals should be restored to their previous states. | ||
| 55 | 77 | ||
| 56 | Mac, Windows and DOS support is broken, probably doesn't even | 78 | This is work in progress, and probably full of bugs. You should |
| 57 | compile -- this will be solved later. | 79 | always run emacs from gdb, so that you'll have a live instance to |
| 80 | debug if something goes wrong. Please send me your reports. | ||
| 58 | 81 | ||
| 59 | Only tested on my GNU/Linux box. | 82 | Problems: |
| 60 | 83 | ||
| 84 | * Suspending Emacs is disabled if there are multiple tty | ||
| 85 | devices. Also, there is no way to suspend emacsclient. This | ||
| 86 | will be fixed. | ||
| 87 | |||
| 88 | * X support is (I hope) working, but at the moment there are | ||
| 89 | problems with simultaneous X and tty devices, so don't do | ||
| 90 | that - start a separate Emacs with -nw and run the server | ||
| 91 | there. | ||
| 92 | |||
| 93 | * Mac, Windows and DOS support is broken, probably doesn't | ||
| 94 | even compile -- this will be solved later. | ||
| 95 | |||
| 96 | * Only tested on my GNU/Linux box. | ||
| 61 | 97 | ||
| 62 | NEWS | 98 | NEWS |
| 63 | ---- | 99 | ---- |
| @@ -88,6 +124,78 @@ CHANGELOG | |||
| 88 | 124 | ||
| 89 | See arch logs. | 125 | See arch logs. |
| 90 | 126 | ||
| 127 | THINGS TO DO | ||
| 128 | ------------ | ||
| 129 | |||
| 130 | ** Fix rif issue with X-tty combo sessions. IMHO the best thing to do | ||
| 131 | is to get rid of that global variable (and use the value value in | ||
| 132 | display_method, which is guaranteed to be correct). | ||
| 133 | |||
| 134 | ** Fix faces on tty frames during X-tty combo sessions. | ||
| 135 | |||
| 136 | ** During an X-tty combo session, a (message "Hello") from a tty frame | ||
| 137 | goes to the X frame. Fix this. | ||
| 138 | |||
| 139 | ** Find out the best way to support suspending Emacs with multiple | ||
| 140 | ttys. My guess: disable it on the controlling tty, but from other | ||
| 141 | ttys pass it on to emacsclient somehow. (It is (I hope) trivial to | ||
| 142 | extend emacsclient to handle suspend/resume. A `kill -STOP' almost | ||
| 143 | works right now.) | ||
| 144 | |||
| 145 | ** Move baud_rate to tty_output. | ||
| 146 | |||
| 147 | ** Do tty output through term_hooks, like graphical display backends. | ||
| 148 | |||
| 149 | ** Implement support for starting an interactive Emacs session without | ||
| 150 | an initial frame. (The user would connect to it and open frames | ||
| 151 | later, with emacsclient.) Not necessarily a good idea. | ||
| 152 | |||
| 153 | ** Fix input from raw ttys (again). | ||
| 154 | |||
| 155 | ** Fix Mac support (I can't do this myself). | ||
| 156 | |||
| 157 | ** Fix W32 support (I can't do this myself). | ||
| 158 | |||
| 159 | ** Fix DOS support (I can't do this myself). | ||
| 160 | |||
| 161 | ** Do a grep on XXX and ?? for more issues. | ||
| 162 | |||
| 163 | ** Understand Emacs's low-level input system (it seems complicated) :-) | ||
| 164 | |||
| 165 | ** What does interrupt_input do? I tried to disable it for raw | ||
| 166 | secondary tty support, but it does not seem to do anything useful. | ||
| 167 | (Update: Look again. X unconditionally enables this, maybe that's | ||
| 168 | why raw terminal support is broken again. I really do need to | ||
| 169 | understand input.) | ||
| 170 | |||
| 171 | ** Make sure C-g goes to the right frame. This is hard, as SIGINT | ||
| 172 | doesn't have a tty parameter. :-( | ||
| 173 | |||
| 174 | ** I have seen a case when Emacs with multiple ttys fell into a loop | ||
| 175 | eating 100% of CPU time. Strace showed this loop: | ||
| 176 | |||
| 177 | getpid() = 30284 | ||
| 178 | kill(30284, SIGIO) = 0 | ||
| 179 | --- SIGIO (I/O possible) @ 0 (0) --- | ||
| 180 | ioctl(6, FIONREAD, [0]) = -1 EIO (Input/output error) | ||
| 181 | ioctl(5, FIONREAD, [0]) = -1 EIO (Input/output error) | ||
| 182 | ioctl(0, FIONREAD, [0]) = 0 | ||
| 183 | sigreturn() = ? (mask now []) | ||
| 184 | gettimeofday({1072842297, 747760}, NULL) = 0 | ||
| 185 | gettimeofday({1072842297, 747806}, NULL) = 0 | ||
| 186 | select(9, [0 3 5 6], NULL, NULL, {0, 0}) = 2 (in [5 6], left {0, 0}) | ||
| 187 | select(9, [0 3 5 6], NULL, NULL, {0, 0}) = 2 (in [5 6], left {0, 0}) | ||
| 188 | gettimeofday({1072842297, 748245}, NULL) = 0 | ||
| 189 | |||
| 190 | I have not been able to reproduce this. | ||
| 191 | |||
| 192 | ** Define a output_initial value for output_method for the initial | ||
| 193 | frame that is dumped with Emacs. Checking for this frame (e.g. in | ||
| 194 | cmd_error_internal) is ugly. | ||
| 195 | |||
| 196 | ** emacsclient -t from an Emacs term buffer does not work, complains | ||
| 197 | about face problems. This can even lock up Emacs (if the recursive | ||
| 198 | frame sets single_kboard). | ||
| 91 | 199 | ||
| 92 | DIARY OF CHANGES | 200 | DIARY OF CHANGES |
| 93 | ---------------- | 201 | ---------------- |
| @@ -222,7 +330,7 @@ DIARY OF CHANGES | |||
| 222 | 330 | ||
| 223 | (Done, nothing to do. It seems that Emacs does not receive SIGHUP | 331 | (Done, nothing to do. It seems that Emacs does not receive SIGHUP |
| 224 | from secondary ttys, which is actually a good thing.) (Update: I | 332 | from secondary ttys, which is actually a good thing.) (Update: I |
| 225 | think it would be a bad idea to remove server-frames anyway.) | 333 | think it would be a bad idea to remove server-frames.) |
| 226 | 334 | ||
| 227 | -- Change emacsclient/server.el to support the -t argument better, | 335 | -- Change emacsclient/server.el to support the -t argument better, |
| 228 | i.e. automatically close the socket when the frame is closed. | 336 | i.e. automatically close the socket when the frame is closed. |
| @@ -316,75 +424,10 @@ DIARY OF CHANGES | |||
| 316 | the point of being unusable. The rif variable causes constant | 424 | the point of being unusable. The rif variable causes constant |
| 317 | core dumps. Handling input is indeed tricky.) | 425 | core dumps. Handling input is indeed tricky.) |
| 318 | 426 | ||
| 319 | THINGS TO DO | 427 | -- Rewrite multi-tty input in terms of MULTI_KBOARD. |
| 320 | ------------ | ||
| 321 | |||
| 322 | ** Fix rif issue with X-tty combo sessions. IMHO the best thing to do | ||
| 323 | is to get rid of that global variable (and use the value value in | ||
| 324 | display_method, which is guaranteed to be correct). | ||
| 325 | |||
| 326 | ** Fix faces on tty frames during X-tty combo sessions. | ||
| 327 | |||
| 328 | ** Find out the best way to support suspending Emacs with multiple | ||
| 329 | ttys. My guess: disable it on the controlling tty, but from other | ||
| 330 | ttys pass it on to emacsclient somehow. (It is (I hope) trivial to | ||
| 331 | extend emacsclient to handle suspend/resume. A `kill -STOP' almost | ||
| 332 | works right now.) | ||
| 333 | |||
| 334 | ** Move baud_rate to tty_output. | ||
| 335 | |||
| 336 | ** Do tty output through term_hooks, like graphical display backends. | ||
| 337 | |||
| 338 | ** Implement support for starting an interactive Emacs session without | ||
| 339 | an initial frame. (The user would connect to it and open frames | ||
| 340 | later, with emacsclient.) Not necessarily a good idea. | ||
| 341 | |||
| 342 | ** Fix input from raw ttys (again). | ||
| 343 | |||
| 344 | ** Fix Mac support (I can't do this myself). | ||
| 345 | |||
| 346 | ** Fix W32 support (I can't do this myself). | ||
| 347 | 428 | ||
| 348 | ** Fix DOS support (I can't do this myself). | 429 | (Done. In fact, there was no need to rewrite anything, I just |
| 349 | 430 | added a kboard member to tty_display_info, and initialized the | |
| 350 | ** Do a grep on XXX and ?? for more issues. | 431 | frame's kboard from there.) |
| 351 | |||
| 352 | ** Understand Emacs's low-level input system (it seems complicated) | ||
| 353 | :-) and maybe rewrite multi-tty input in terms of MULTI_KBOARD. | ||
| 354 | (Update: This backtrace from a tty-X combo session hints that this | ||
| 355 | may be necessary.) | ||
| 356 | |||
| 357 | #0 abort () at /home/lorentey/work/emacs/emacs--multi-tty/src/emacs.c:417 | ||
| 358 | #1 0x081104fb in read_char (commandflag=0, nmaps=0, maps=0x0, prev_event=675499188, used_mouse_menu=0x0) at /home/lorentey/work/emacs/emacs--multi-tty/src/keyboard.c:2581 | ||
| 359 | #2 0x0819f23e in read_filtered_event (no_switch_frame=1, ascii_required=0, error_nonascii=0, input_method=0) at /home/lorentey/work/emacs/emacs--multi-tty/src/lread.c:468 | ||
| 360 | #3 0x0819387c in Fy_or_n_p (prompt=1759896324) at /home/lorentey/work/emacs/emacs--multi-tty/src/fns.c:3115 | ||
| 361 | ... | ||
| 362 | |||
| 363 | ** What does interrupt_input do? I tried to disable it for raw | ||
| 364 | secondary tty support, but it does not seem to do anything useful. | ||
| 365 | (Update: Look again. X unconditionally enables this, maybe that's | ||
| 366 | why raw terminal support is broken again. I really do need to | ||
| 367 | understand input.) | ||
| 368 | |||
| 369 | ** Make sure C-g goes to the right frame. This is hard, as SIGINT | ||
| 370 | doesn't have a tty parameter. :-( | ||
| 371 | |||
| 372 | ** I have seen a case when Emacs with multiple ttys fell into a loop | ||
| 373 | eating 100% of CPU time. Strace showed this loop: | ||
| 374 | |||
| 375 | getpid() = 30284 | ||
| 376 | kill(30284, SIGIO) = 0 | ||
| 377 | --- SIGIO (I/O possible) @ 0 (0) --- | ||
| 378 | ioctl(6, FIONREAD, [0]) = -1 EIO (Input/output error) | ||
| 379 | ioctl(5, FIONREAD, [0]) = -1 EIO (Input/output error) | ||
| 380 | ioctl(0, FIONREAD, [0]) = 0 | ||
| 381 | sigreturn() = ? (mask now []) | ||
| 382 | gettimeofday({1072842297, 747760}, NULL) = 0 | ||
| 383 | gettimeofday({1072842297, 747806}, NULL) = 0 | ||
| 384 | select(9, [0 3 5 6], NULL, NULL, {0, 0}) = 2 (in [5 6], left {0, 0}) | ||
| 385 | select(9, [0 3 5 6], NULL, NULL, {0, 0}) = 2 (in [5 6], left {0, 0}) | ||
| 386 | gettimeofday({1072842297, 748245}, NULL) = 0 | ||
| 387 | |||
| 388 | I have not been able to reproduce this. | ||
| 389 | 432 | ||
| 390 | ;;; arch-tag: 8da1619e-2e79-41a8-9ac9-a0485daad17d | 433 | ;;; arch-tag: 8da1619e-2e79-41a8-9ac9-a0485daad17d |