aboutsummaryrefslogtreecommitdiffstats
path: root/README.multi-tty
diff options
context:
space:
mode:
authorKaroly Lorentey2004-01-02 02:54:17 +0000
committerKaroly Lorentey2004-01-02 02:54:17 +0000
commit7b00d185eba8e01f191a69740e3270c88f88159c (patch)
tree1bddf818e98404035261883f3cbfc5e4c80f40bf /README.multi-tty
parentdaf0170133e658c41f3ae2fc8558c5ab74227c1d (diff)
downloademacs-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-tty223
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
6multiple, different tty devices and simultaneous X and tty frames from 6multiple, different tty devices and simultaneous X and tty frames from
7a single Emacs session. 7a single Emacs session.
8 8
9Some use cases:
10
11Emacs is notoriously slow at startup, so most people use another
12editor or emacsclient for quick editing jobs from the console.
13Unfortunately, emacsclient was very awkward to use, because it did not
14support opening a new Emacs frame on the current virtual console.
15Now, with multi-tty support, it can do that. (Emacsclient starts up
16faster than vi!)
17
18Some Gnus users (including me) run Gnus in an X frame in its own Emacs
19instance, which they typically leave running for weeks. It would be
20nice if they could connect to this instance from a remote ssh session
21and check their messages without opening a remote X frame or resorting
22to gnus-slave.
23
24
9WHO IS DOING IT 25WHO 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
38versions of arch will do fine, I think.)
39
40If you don't have arch, the branch has a homepage from which you can
41download conventional patches against Emacs CVS HEAD:
22 42
43 http://lorentey.web.elte.hu/project/emacs.html
23 44
24STATUS 45STATUS
25------ 46------
26 47
27Basic multi-tty support is there; there are some rough edges, but it 48Multi-tty support is stable, I think most of the problems were fixed.
28already seems to be usable. Emacsclient has been extended to support 49(It still needs testing on other architectures, though.) Please let
29opening a new terminal frame. 50me know if you find any bugs in it. Emacsclient has been extended to
51support opening a new terminal frame.
30 52
31To try it out, compile the multi-tty branch with the following 53To try it out, compile and run the multi-tty branch with the following
32commands: 54commands:
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
39then start up the emacs server (src/emacs -nw, M-x server-start), and 63and then (from a shell prompt on another terminal) start emacsclient
40then (from a shell prompt on another terminal) start emacsclient with 64with
41 65
42 lib-src/emacsclient -f /optional/file/names... 66 lib-src/emacsclient -t /optional/file/names...
43 67
44You'll hopefully have two fully working, independent frames on 68You'll hopefully have two fully working, independent frames on
45separate terminals. (This seems to be very useful, emacsclient starts 69separate terminals. The new frame is closed automatically when you
46up even faster than vi!) :-) You can close the newly opened frame and 70have finished editing the specified files (C-x #), but delete-frame
47return 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
48delete-frame. Creating new frames on the same tty with C-x 5 2 72two tty devices.
49works exactly as before. Suspending Emacs is disabled at the moment.
50If you exit emacs, all terminals should be restored to their previous
51states.
52 73
53X support is (I hope) working, but at the moment there are problems 74Creating new frames on the same tty with C-x 5 2 works, and they
54with simultaneous X and tty devices, so don't do that. 75behave the same way as in previous Emacs versions. If you exit emacs,
76all terminals should be restored to their previous states.
55 77
56Mac, Windows and DOS support is broken, probably doesn't even 78This is work in progress, and probably full of bugs. You should
57compile -- this will be solved later. 79always run emacs from gdb, so that you'll have a live instance to
80debug if something goes wrong. Please send me your reports.
58 81
59Only tested on my GNU/Linux box. 82Problems:
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
62NEWS 98NEWS
63---- 99----
@@ -88,6 +124,78 @@ CHANGELOG
88 124
89See arch logs. 125See arch logs.
90 126
127THINGS 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
92DIARY OF CHANGES 200DIARY 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
319THINGS 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