diff options
| author | Karoly Lorentey | 2003-12-31 05:09:29 +0000 |
|---|---|---|
| committer | Karoly Lorentey | 2003-12-31 05:09:29 +0000 |
| commit | 819b8f00ed7b8a9a2190efaa02376ed332ecf763 (patch) | |
| tree | c30ab72204225385c428db008580a9f67f5c215c /README.multi-tty | |
| parent | 16c290d8c16fb0fdb574c837c6b1badbc655efe2 (diff) | |
| download | emacs-819b8f00ed7b8a9a2190efaa02376ed332ecf763.tar.gz emacs-819b8f00ed7b8a9a2190efaa02376ed332ecf763.zip | |
A few more bugfixes and new features.
(Sigh.) I obviously need to remember to separate individual changes
to multiple commits.
src/emacsclient.c: Improved error handling.
(decode_options): Changed frame option (again) from -f to -t.
(print_help_and_exit): Ditto.
(copy_from_to): Check EINTR after write, not EAGAIN. Removed SIGIO hack.
(pty_conversation): Handle errors transmitted through the socket.
Handle pty errors by not reading from it anymore.
(main): Restore correct errno after socket_status failed. Send -tty
on -t, not -pty.
lisp/server.el (server-process-filter): Watch -tty, not -pty.
Use make-frame-on-tty instead of make-terminal-frame.
Don't set newframe to t if make-frame-on-tty failed.
Don't delete frames here. Print correct message when there are no
files to edit, but a new frame was requested.
(server-sentinel): Delete the frame after the process.
(server-handle-delete-frame): New function for delete-frame-functions.
(server-start): Add server-handle-delete-frame to delete-frame-functions.
(server-buffer-done): Don't delete frames here.
src/alloc.c (mark_ttys): Add prototype.
(Fgarbage_collect): Call mark_ttys.
src/emacs.c: (shut_down_emacs): Don't flush stdout before
reset_sys_modes().
src/process.c (add_keyboard_wait_descriptor_called_flag): Removed.
(add_keyboard_wait_descriptor): Removed stdin hack.
src/sysdep.c: Unconditionally include sysselect.h.
(old_fcntl_flags): Changed to an array.
(init_sigio, reset_sigio): Use it.
(narrow_foreground_group, widen_foreground_group): Use setpgid, not
setpgrp.
(old_fcntl_owner): Changed to an array.
(init_sys_modes, reset_sys_modes): Use it. Fix fsync() and reset_sigio() calls.
src/term.c (Qframe_tty_name, Qframe_tty_type): New variables.
(syms_of_term): Initialize them.
(Fframe_tty_name, Fframe_tty_type): New functions.
(term_init): Call add_keyboard_wait_descriptor().
(Fdelete_tty): New function.
(delete_tty): Call delete_keyboard_wait_descriptor().
(get_current_tty): Removed.
(mark_ttys): New function.
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-28
Diffstat (limited to 'README.multi-tty')
| -rw-r--r-- | README.multi-tty | 118 |
1 files changed, 86 insertions, 32 deletions
diff --git a/README.multi-tty b/README.multi-tty index 2ee943b6ed5..4519be4e756 100644 --- a/README.multi-tty +++ b/README.multi-tty | |||
| @@ -45,15 +45,13 @@ You'll hopefully have two fully working, independent frames on | |||
| 45 | separate terminals. (This seems to be very useful, emacsclient starts | 45 | separate terminals. (This seems to be very useful, emacsclient starts |
| 46 | up even faster than vi!) :-) You can close the newly opened frame and | 46 | up even faster than vi!) :-) You can close the newly opened frame and |
| 47 | return to the shell without exiting Emacs by pressing C-x 5 0, i.e., | 47 | return to the shell without exiting Emacs by pressing C-x 5 0, i.e., |
| 48 | delete-frame. (Note that this does not seem to work yet on the | 48 | delete-frame. Creating new frames on the same tty with C-x 5 2 |
| 49 | original terminal.) Creating new frames on the same tty with C-x 5 2 | ||
| 50 | works exactly as before. Suspending Emacs is disabled at the moment. | 49 | works exactly as before. Suspending Emacs is disabled at the moment. |
| 51 | If you exit emacs, all terminals should be restored to their previous | 50 | If you exit emacs, all terminals should be restored to their previous |
| 52 | states. | 51 | states. |
| 53 | 52 | ||
| 54 | X, Mac, Windows and DOS support is broken, probably doesn't even | 53 | X, Mac, Windows and DOS support is broken, probably doesn't even |
| 55 | compile -- this will be solved later. Please see the attached README | 54 | compile -- this will be solved later. |
| 56 | for other issues, implementation notes and sub-TODO items. | ||
| 57 | 55 | ||
| 58 | Only tested on my GNU/Linux box. | 56 | Only tested on my GNU/Linux box. |
| 59 | 57 | ||
| @@ -75,6 +73,10 @@ For the NEWS file: | |||
| 75 | ** A make-frame-on-tty function has been added to make it easier to | 73 | ** A make-frame-on-tty function has been added to make it easier to |
| 76 | create frames on new terminals. | 74 | create frames on new terminals. |
| 77 | 75 | ||
| 76 | ** New functions: frame-tty-name, frame-tty-type for accessing | ||
| 77 | terminal parameters, and delete-tty for closing the terminal | ||
| 78 | device. | ||
| 79 | |||
| 78 | ** Emacsclient has been extended to support opening a new terminal | 80 | ** Emacsclient has been extended to support opening a new terminal |
| 79 | frame. | 81 | frame. |
| 80 | 82 | ||
| @@ -108,6 +110,8 @@ DIARY OF CHANGES | |||
| 108 | succeeds. MULTIKBOARD is not used. Secondary terminals don't send | 110 | succeeds. MULTIKBOARD is not used. Secondary terminals don't send |
| 109 | SIGIO!) | 111 | SIGIO!) |
| 110 | 112 | ||
| 113 | (Update: They do, now.) | ||
| 114 | |||
| 111 | -- other-frame should cycle through the frames on the `current' | 115 | -- other-frame should cycle through the frames on the `current' |
| 112 | terminal only. | 116 | terminal only. |
| 113 | 117 | ||
| @@ -159,6 +163,10 @@ DIARY OF CHANGES | |||
| 159 | (Update: This is bullshit. There is a read_input_waiting function, | 163 | (Update: This is bullshit. There is a read_input_waiting function, |
| 160 | extend that somehow.) | 164 | extend that somehow.) |
| 161 | 165 | ||
| 166 | (Update of update: The first update was not right either, extending | ||
| 167 | read_input_waiting was not necessary. Secondary ttys do seem to | ||
| 168 | send signals on input.) | ||
| 169 | |||
| 162 | -- Make make-terminal-frame look up the `tty' and `tty-type' frame | 170 | -- Make make-terminal-frame look up the `tty' and `tty-type' frame |
| 163 | parameters from the currently selected terminal before the global | 171 | parameters from the currently selected terminal before the global |
| 164 | default. | 172 | default. |
| @@ -231,56 +239,67 @@ DIARY OF CHANGES | |||
| 231 | free()ing memory. Utterly trivial matter. I love the C's memory | 239 | free()ing memory. Utterly trivial matter. I love the C's memory |
| 232 | management, it puts hair on your chest.) | 240 | management, it puts hair on your chest.) |
| 233 | 241 | ||
| 234 | THINGS TO DO | 242 | -- Support raw secondary terminals. (Note that SIGIO works only on |
| 235 | ------------ | 243 | the controlling terminal.) Hint: extend read_input_waiting() for |
| 244 | multiple ttys and hopefully this will be fixed. | ||
| 236 | 245 | ||
| 237 | ** Understand Emacs's low-level input system (it seems complicated) :-) | 246 | (Done, it seems to have been working already for some time. It |
| 238 | and maybe rewrite multi-tty input in terms of MULTIKBOARD. | 247 | seems F_SETOWN does work, after all. Not sure what made it fail |
| 248 | earlier, but it seems to be fixed (there were several changes | ||
| 249 | around request_sigio, maybe one of them did it). | ||
| 250 | read_input_waiting() is only used in sys_select(), don't change | ||
| 251 | it.) | ||
| 239 | 252 | ||
| 240 | ** Find out why does Emacs abort when it wants to close its | 253 | -- Find out why does Emacs abort when it wants to close its |
| 241 | controlling tty. Hint: chan_process[] array. Hey, maybe | 254 | controlling tty. Hint: chan_process[] array. Hey, maybe |
| 242 | noninterrupt-IO would work, too? Update: no, there is no process | 255 | noninterrupt-IO would work, too? Update: no, there is no process |
| 243 | for stdin/out. | 256 | for stdin/out. |
| 244 | 257 | ||
| 245 | ** Support raw secondary terminals. (Note that SIGIO works only on | 258 | (Done. Added add/delete_keyboard_wait_descriptor to |
| 246 | the controlling terminal.) Hint: extend read_input_waiting() for | 259 | term_init/delete_tty. The hint was right, in a way.) |
| 247 | multiple ttys and hopefully this will be fixed. | ||
| 248 | |||
| 249 | ** What does interrupt_input do? I tried to disable it for raw | ||
| 250 | secondary tty support, but it does not seem to do anything useful. | ||
| 251 | 260 | ||
| 252 | ** Issue with SIGIO: it needs to be disabled during redisplay. See if | 261 | -- Issue with SIGIO: it needs to be disabled during redisplay. See if |
| 253 | fcntl() kernel behaviour could be emulated by emacsclient. | 262 | fcntl() kernel behaviour could be emulated by emacsclient. |
| 254 | 263 | ||
| 255 | ** Get rid of the accessor macros in termchar.h, or define macros for | 264 | (Done. Simply disabled the SIGIO emulation hack in emacsclient.) |
| 256 | all members. | ||
| 257 | |||
| 258 | ** Make parts of struct tty_output accessible from Lisp. The device | ||
| 259 | name and the type is sufficient. | ||
| 260 | 265 | ||
| 261 | ** server.el: There are issues with saving files in buffers of closed | 266 | -- server.el: There are issues with saving files in buffers of closed |
| 262 | clients. Try editing a file with emacsclient -f, and (without | 267 | clients. Try editing a file with emacsclient -f, and (without |
| 263 | saving it) do a delete-frame. The frame is closed without | 268 | saving it) do a delete-frame. The frame is closed without |
| 264 | question, and a surprising confirmation prompt appears in another | 269 | question, and a surprising confirmation prompt appears in another |
| 265 | frame. | 270 | frame. |
| 266 | 271 | ||
| 267 | ** emacsclient.el, server.el: Handle eval or file open errors when | 272 | (Done. delete-frame now asks for confirmation if it still has |
| 273 | pending buffers, and modified buffers don't seem to be deleted.) | ||
| 274 | |||
| 275 | -- emacsclient.el, server.el: Handle eval or file open errors when | ||
| 268 | doing -f. | 276 | doing -f. |
| 269 | 277 | ||
| 270 | ** Export delete_tty to the Lisp environment, for emacsclient. | 278 | (Done.) |
| 271 | 279 | ||
| 272 | ** Make sure C-g goes to the right frame. This is hard, as SIGINT | 280 | -- Make parts of struct tty_output accessible from Lisp. The device |
| 273 | doesn't have a tty parameter. :-( | 281 | name and the type is sufficient. |
| 274 | 282 | ||
| 275 | ** Implement support for starting an interactive Emacs session without | 283 | (Done, see frame-tty-name and frame-tty-type.) |
| 276 | an initial frame. (The user would connect to it and open frames | 284 | |
| 277 | later, with emacsclient.) Not necessarily a good idea. | 285 | -- Export delete_tty to the Lisp environment, for emacsclient. |
| 278 | 286 | ||
| 279 | ** Move optimalization parameters (costs) from union output_data to | 287 | (Done, see delete-tty.) |
| 280 | a backend-neutral per-device structure. | 288 | |
| 289 | |||
| 290 | THINGS TO DO | ||
| 291 | ------------ | ||
| 281 | 292 | ||
| 282 | ** Find out the best way to support suspending Emacs with multiple | 293 | ** Find out the best way to support suspending Emacs with multiple |
| 283 | ttys. | 294 | ttys. My guess: disable it on the controlling tty, but other ttys |
| 295 | should pass it on to emacsclient somehow. (It is (I hope) trivial | ||
| 296 | to extend emacsclient to handle suspend/resume. A `kill -STOP' | ||
| 297 | almost works right now.) | ||
| 298 | |||
| 299 | ** Move baud_rate to tty_output. | ||
| 300 | |||
| 301 | ** Move device-specific parameters (like costs) commonly used by | ||
| 302 | device backends to a common, device-dependent structure. | ||
| 284 | 303 | ||
| 285 | ** Do tty output through term_hooks, like graphical display backends. | 304 | ** Do tty output through term_hooks, like graphical display backends. |
| 286 | 305 | ||
| @@ -289,6 +308,10 @@ THINGS TO DO | |||
| 289 | ** Allow simultaneous X and tty frames. (Handling input could be | 308 | ** Allow simultaneous X and tty frames. (Handling input could be |
| 290 | tricky.) | 309 | tricky.) |
| 291 | 310 | ||
| 311 | ** Implement support for starting an interactive Emacs session without | ||
| 312 | an initial frame. (The user would connect to it and open frames | ||
| 313 | later, with emacsclient.) Not necessarily a good idea. | ||
| 314 | |||
| 292 | ** Fix Mac support (I can't do this myself). | 315 | ** Fix Mac support (I can't do this myself). |
| 293 | 316 | ||
| 294 | ** Fix W32 support (I can't do this myself). | 317 | ** Fix W32 support (I can't do this myself). |
| @@ -297,4 +320,35 @@ THINGS TO DO | |||
| 297 | 320 | ||
| 298 | ** Do a grep on XXX and ?? for more issues. | 321 | ** Do a grep on XXX and ?? for more issues. |
| 299 | 322 | ||
| 323 | ** Get rid of the accessor macros in termchar.h, or define macros for | ||
| 324 | all members. | ||
| 325 | |||
| 326 | ** Understand Emacs's low-level input system (it seems complicated) :-) | ||
| 327 | and maybe rewrite multi-tty input in terms of MULTIKBOARD. | ||
| 328 | |||
| 329 | ** What does interrupt_input do? I tried to disable it for raw | ||
| 330 | secondary tty support, but it does not seem to do anything useful. | ||
| 331 | |||
| 332 | ** Make sure C-g goes to the right frame. This is hard, as SIGINT | ||
| 333 | doesn't have a tty parameter. :-( | ||
| 334 | |||
| 335 | ** I have seen a case when Emacs with multiple ttys went ate 100% of | ||
| 336 | CPU time. Strace showed this loop: | ||
| 337 | |||
| 338 | |||
| 339 | getpid() = 30284 | ||
| 340 | kill(30284, SIGIO) = 0 | ||
| 341 | --- SIGIO (I/O possible) @ 0 (0) --- | ||
| 342 | ioctl(6, FIONREAD, [0]) = -1 EIO (Input/output error) | ||
| 343 | ioctl(5, FIONREAD, [0]) = -1 EIO (Input/output error) | ||
| 344 | ioctl(0, FIONREAD, [0]) = 0 | ||
| 345 | sigreturn() = ? (mask now []) | ||
| 346 | gettimeofday({1072842297, 747760}, NULL) = 0 | ||
| 347 | gettimeofday({1072842297, 747806}, NULL) = 0 | ||
| 348 | select(9, [0 3 5 6], NULL, NULL, {0, 0}) = 2 (in [5 6], left {0, 0}) | ||
| 349 | select(9, [0 3 5 6], NULL, NULL, {0, 0}) = 2 (in [5 6], left {0, 0}) | ||
| 350 | gettimeofday({1072842297, 748245}, NULL) = 0 | ||
| 351 | |||
| 352 | I have not been able to reproduce this. | ||
| 353 | |||
| 300 | ;;; arch-tag: 8da1619e-2e79-41a8-9ac9-a0485daad17d | 354 | ;;; arch-tag: 8da1619e-2e79-41a8-9ac9-a0485daad17d |