Commit | Line | Data |
---|---|---|
3224dac1 | 1 | -*- coding: utf-8; mode: text; -*- |
28d440ab KL |
2 | GOAL |
3 | ---- | |
4 | ||
2246281f KL |
5 | The goal of this branch is to implement support for opening multiple, |
6 | different tty devices and simultaneous X and tty frames from a single | |
7 | Emacs session. | |
28d440ab | 8 | |
7b00d185 | 9 | Some use cases: |
7b00d185 KL |
10 | Emacs is notoriously slow at startup, so most people use another |
11 | editor or emacsclient for quick editing jobs from the console. | |
12 | Unfortunately, emacsclient was very awkward to use, because it did not | |
13 | support opening a new Emacs frame on the current virtual console. | |
14 | Now, with multi-tty support, it can do that. (Emacsclient starts up | |
15 | faster than vi!) | |
16 | ||
17 | Some Gnus users (including me) run Gnus in an X frame in its own Emacs | |
18 | instance, which they typically leave running for weeks. It would be | |
19 | nice if they could connect to this instance from a remote ssh session | |
20 | and check their messages without opening a remote X frame or resorting | |
21 | to gnus-slave. | |
22 | ||
28d440ab KL |
23 | WHO IS DOING IT |
24 | --------------- | |
25 | ||
26 | I'm Károly Lőrentey. My address: lorentey@elte.hu. | |
27 | ||
2246281f | 28 | Comments, bug reports, suggestions and patches are welcome! |
28d440ab | 29 | |
6548cf00 | 30 | Retrieving the latest version of the branch: |
4f0359de KL |
31 | |
32 | tla register-archive lorentey@elte.hu--2004 http://lorentey.web.elte.hu/arch/2004/ | |
daf01701 | 33 | tla get lorentey@elte.hu--2004/emacs--multi-tty <directory> |
4f0359de | 34 | |
7b00d185 KL |
35 | (I use a recent arch development snapshot, but any of the released |
36 | versions of arch will do fine, I think.) | |
37 | ||
38 | If you don't have arch, the branch has a homepage from which you can | |
39 | download conventional patches against Emacs CVS HEAD: | |
4f0359de | 40 | |
7b00d185 | 41 | http://lorentey.web.elte.hu/project/emacs.html |
28d440ab | 42 | |
6c3d443b KL |
43 | If you want to be notified of new revisions, sign up to the |
44 | multi-tty@listbox.elte.hu mailing list by visiting the | |
45 | below homepage and following its instructions. | |
46 | ||
47 | https://listbox.elte.hu/mailman/listinfo/multi-tty | |
48 | ||
49 | Please note that the multi-tty mailing list is read-only, and is | |
50 | reserved for automatic commit messages. Discussion about the branch | |
51 | and bug reports should be sent directly to me (lorentey@elte.hu), or | |
aaaf7fe1 KL |
52 | to the emacs-devel@gnu.org mailing list. (I hope to merge my branch |
53 | into CVS HEAD reasonably soon, so I don't want to set up an elaborate | |
54 | development infrastructure for the multi-tty branch.) | |
6c3d443b | 55 | |
28d440ab KL |
56 | STATUS |
57 | ------ | |
58 | ||
bacb6689 KL |
59 | The branch is now very stable and almost full-featured. I hope the |
60 | major problems were fixed. (It still needs testing on other | |
61 | architectures, though.) Both multiple tty device support and | |
62 | simultaneous X and tty frame support works fine. Emacsclient has been | |
aaaf7fe1 KL |
63 | extended to support opening new tty and X frames. It has been changed |
64 | open new Emacs frames by default. | |
2246281f | 65 | |
2246281f | 66 | Please let me know if you find any bugs in this branch. |
28d440ab | 67 | |
0c72d684 KL |
68 | HOW TO COMPILE AND TEST |
69 | ----------------------- | |
70 | ||
aaaf7fe1 KL |
71 | To try out the multi-tty branch, compile and run the multi-tty branch |
72 | with the following commands: | |
bc279d67 | 73 | |
2a0c7b06 | 74 | find -name "*.elc" | xargs rm # Delete leftover stuff |
bc279d67 KL |
75 | mkdir +build |
76 | cd +build | |
0c72d684 | 77 | ../configure <your favourite options> |
bc279d67 | 78 | make bootstrap |
2246281f | 79 | src/emacs -nw # You can also try without -nw |
7b00d185 | 80 | M-x server-start |
bc279d67 | 81 | |
7b00d185 KL |
82 | and then (from a shell prompt on another terminal) start emacsclient |
83 | with | |
aaaf7fe1 KL |
84 | lib-src/emacsclient /optional/file/names... |
85 | or | |
7b00d185 | 86 | lib-src/emacsclient -t /optional/file/names... |
28d440ab | 87 | |
04c3243c | 88 | You'll hopefully have two fully working, independent frames on |
7b00d185 | 89 | separate terminals. The new frame is closed automatically when you |
2a0c7b06 KL |
90 | finish editing the specified files (C-x #), but delete-frame (C-x 5 0) |
91 | also works. Of course, you can create frames on more than two tty | |
92 | devices. | |
52c2ee2a | 93 | |
7b00d185 KL |
94 | Creating new frames on the same tty with C-x 5 2 works, and they |
95 | behave the same way as in previous Emacs versions. If you exit emacs, | |
96 | all terminals should be restored to their previous states. | |
daf01701 | 97 | |
7b00d185 KL |
98 | This is work in progress, and probably full of bugs. You should |
99 | always run emacs from gdb, so that you'll have a live instance to | |
2246281f | 100 | debug if something goes wrong. Please send me your bug reports. |
04c3243c | 101 | |
bacb6689 KL |
102 | I think the best way to use the new Emacs is to have it running inside |
103 | a disconnected GNU screen session, and always use emacsclient for | |
104 | normal work. This way not a single keystroke of your work will be | |
105 | lost if the display device that you are using crashes, or the network | |
106 | connection times out, or whatever. As long as the server that runs | |
107 | your Emacs remains up, all your buffers remain exactly as they were | |
108 | before the crash, and you can continue working as if nothing had | |
109 | happened. (I had an extremely unstable X server for some time while I | |
110 | was developing these patches, and running Emacs this way has saved me | |
111 | a number of M-x recover-session invocations.) | |
112 | ||
113 | (I am thinking about introducing a --daemon option to get rid of the | |
114 | above screen dependency.) | |
115 | ||
7b00d185 | 116 | Problems: |
6548cf00 | 117 | |
7b00d185 KL |
118 | * Mac, Windows and DOS support is broken, probably doesn't |
119 | even compile -- this will be solved later. | |
120 | ||
d3c554a0 | 121 | * Only tested on my GNU/Linux box, Solaris 8 and FreeBSD. |
28d440ab KL |
122 | |
123 | NEWS | |
124 | ---- | |
125 | ||
126 | For the NEWS file: | |
127 | ||
2246281f | 128 | ** Support for multiple terminal devices has been added. |
6548cf00 | 129 | |
2246281f KL |
130 | *** You can specify a terminal device (`tty' parameter) and a terminal |
131 | type (`tty-type' parameter) to `make-terminal-frame'. | |
6548cf00 | 132 | |
2246281f KL |
133 | *** You can test for the presence of multiple terminal support by |
134 | testing for the `multi-tty' feature. | |
28d440ab | 135 | |
2246281f | 136 | *** Emacsclient has been extended to support opening a new terminal |
aaaf7fe1 KL |
137 | frame. Its behaviour has been changed to open a new Emacs frame by |
138 | default. Use the -c option to get the old behavior of opening | |
139 | files in the currently selected Emacs frame. | |
e5299d8d | 140 | |
2246281f KL |
141 | *** A make-frame-on-tty function has been added to make it easier to |
142 | create frames on new terminals. | |
143 | ||
144 | *** New functions: frame-tty-name, frame-tty-type for accessing | |
145 | terminal parameters, and delete-tty for closing the terminal | |
146 | device. | |
147 | ||
148 | *** talk.el has been extended for multiple tty support. | |
149 | ||
150 | ||
151 | ** Support for simultaneous graphical and terminal frames has been | |
152 | added. | |
153 | ||
154 | *** The function `make-frame-on-display' now works during a terminal | |
155 | session, and `make-frame-on-tty' works during a graphical session. | |
156 | ||
157 | *** The `window-system' variable has been made frame-local. | |
158 | ||
159 | *** The new `initial-window-system' variable contains the | |
160 | `window-system' value for the first frame. | |
819b8f00 | 161 | |
d448e982 KL |
162 | THANKS |
163 | ------ | |
164 | ||
165 | The following is an (incomplete) list of people who have contributed | |
166 | to the project by testing, bug reports, and suggestions. Thanks! | |
167 | ||
026ad6ba | 168 | Robert J. Chassell <bob at rattlesnake dot com> |
806c1866 | 169 | Romain Francoise <romain at orebokech dot com> |
0c72d684 | 170 | Ami Fischman <ami at fischman dot org> |
4edd8a5c | 171 | Istvan Marko <mi-mtty ar kismala dot com> |
0c72d684 | 172 | Dan Nicolaescu <dann at ics dot uci dot edu> |
cd5355f9 | 173 | Gergely Nagy <algernon at debian dot org> |
aaaf7fe1 | 174 | Mark Plaksin <happy at mcplaksin dot org> |
026ad6ba | 175 | Francisco Borges <borges at let dot rug dot nl> |
d3c554a0 | 176 | Frank Ruell <stoerte at dreamwarrior dot net> |
9002956f | 177 | and many others. |
0c72d684 | 178 | |
d3c554a0 KL |
179 | Richard Stallman was kind enough to review an earlier version of my |
180 | patches. | |
d448e982 | 181 | |
28d440ab KL |
182 | CHANGELOG |
183 | --------- | |
184 | ||
185 | See arch logs. | |
186 | ||
7b00d185 KL |
187 | THINGS TO DO |
188 | ------------ | |
4edd8a5c | 189 | |
d3c554a0 KL |
190 | ** Fix set-input-mode for multi-tty. It's a truly horrible interface; |
191 | what if we'd blow it up into several separate functions (with a | |
192 | compatibility definition)? | |
193 | ||
4388f101 KL |
194 | ** Emacs assumes that all terminal frames have the same locale |
195 | settings as Emacs itself. This may lead to bogus results in a | |
196 | multi-locale setup. (E.g., while logging in from a remote client | |
197 | with a different locale.) | |
198 | ||
cd5355f9 KL |
199 | ** The single-keyboard mode of MULTI_KBOARD is extremely confusing |
200 | sometimes; Emacs does not respond to stimuli from other keyboards. | |
201 | At least a beep or a message would be important, if the single-mode | |
202 | is still required to prevent interference. (Reported by Dan | |
026ad6ba KL |
203 | Nicolaescu.) (Update: selecting a region with the mouse enables |
204 | single_kboard under X. This is very confusing.) | |
cd5355f9 | 205 | |
2666355c | 206 | ** Change Lisp code not to (getenv "TERM"); use the `tty-type' frame |
d3c554a0 KL |
207 | parameter or the frame-tty-type function instead. (M-x tags-search |
208 | "TERM" helps with this.) Update: Actually, all getenv invocations | |
209 | should be checked for multi-tty compatibility, and an interface | |
210 | must be implemented to get the remote client's environment. | |
2666355c KL |
211 | |
212 | ** The terminal customization files in term/*.el tend to change global | |
213 | parameters, which may confuse Emacs with multiple displays. Change | |
214 | them to tweak only frame-local settings, if possible. | |
215 | ||
01d81f75 KL |
216 | ** Dan Nicolaescu suggests that -nw should be added as an alias for -t |
217 | in emacsclient. Good idea. (Alas, implementing this is not | |
218 | trivial, getopt_long does not seem to support two-letter ``short'' | |
d3c554a0 | 219 | options. Patches are welcome.) :-) |
01d81f75 KL |
220 | |
221 | ** Mark Plaksin suggests that emacsclient should accept the same | |
222 | X-related command-line arguments as Emacs. Most of the X-related | |
223 | argument-handling is done in Lisp, so this should be quite easy to | |
224 | implement. | |
d448e982 | 225 | |
cd5355f9 KL |
226 | ** Gergely Nagy suggests that C-x # should only kill the current |
227 | frame, not any other emacsclient frame that may have the same file | |
228 | opened for editing. I think I agree with him. | |
229 | ||
d3c554a0 KL |
230 | ** Miles Bader suggests that C-x C-c on an emacsclient frame should |
231 | only close the frame, not exit the entire Emacs session. | |
232 | ||
0b0d3e0b | 233 | ** Make `struct display' accessible to Lisp programs. Accessor functions: |
4ca927b4 | 234 | |
0b0d3e0b | 235 | (displayp OBJECT): Returns t if OBJECT is a display. |
7b00d185 | 236 | |
4388f101 KL |
237 | (display-list): Returns list of currently active displays. |
238 | ||
0b0d3e0b KL |
239 | (selected-display): Returns the display object of the selected frame. |
240 | ||
241 | (frame-display FRAME): Returns the display object of FRAME. | |
242 | ||
243 | (display-frames DISPLAY): Returns a list of frames on DISPLAY. | |
244 | ||
245 | (display-type DISPLAY): Returns the type of DISPLAY, as a | |
246 | symbol. (See `framep'.) | |
247 | ||
248 | (display-device DISPLAY): Returns the name of the device that | |
249 | DISPLAY uses, as a string. (E.g: "/dev/pts/16", or | |
250 | ":0.0") | |
251 | ||
4388f101 KL |
252 | etc. |
253 | ||
0b0d3e0b KL |
254 | See next issue why this is necessary. |
255 | ||
256 | ** The following needs to be supported: | |
257 | ||
258 | $ emacsclient -t | |
259 | C-z | |
0b0d3e0b KL |
260 | $ emacsclient -t |
261 | (This fails now.) | |
262 | ||
263 | The cleanest way to solve this is to allow multiple displays on the | |
264 | same terminal device; each new emacsclient process should create | |
265 | its own display. As displays are currently identified by their | |
266 | device names, this is not possible until struct display becomes | |
267 | accessible as a Lisp-level object. | |
bacb6689 KL |
268 | |
269 | ** Add an elaborate mechanism for display-local variables. (There are | |
270 | already a few of these; search for `terminal-local' in the Elisp | |
271 | manual.) | |
272 | ||
0b0d3e0b KL |
273 | ** Very strange bug: visible-bell does not work on secondary |
274 | terminals in xterm and konsole. The screen does flicker a bit, | |
275 | but it's so quick it isn't noticable. | |
276 | ||
277 | ** Clean up the frame-local variable system. I think it's ugly and | |
278 | error-prone. But maybe I just haven't yet fully understood it. | |
279 | ||
428a555e | 280 | ** Move baud_rate to struct display. |
7b00d185 | 281 | |
7b00d185 KL |
282 | ** Implement support for starting an interactive Emacs session without |
283 | an initial frame. (The user would connect to it and open frames | |
f70dd009 | 284 | later, with emacsclient.) |
7b00d185 | 285 | |
3224dac1 KL |
286 | ** Fix Mac support (I can't do this myself). Note that the current |
287 | state of Mac-specific source files in the multi-tty tree are not | |
288 | useful; before starting work on Mac support, revert to pristine, | |
289 | pre-multi-tty versions. | |
7b00d185 | 290 | |
3224dac1 KL |
291 | ** Fix W32 support (I can't do this myself). Note that the current |
292 | state of W32-specific source files in the multi-tty tree are not | |
293 | useful; before starting work on W32 support, revert to pristine, | |
294 | pre-multi-tty versions. | |
7b00d185 | 295 | |
3224dac1 KL |
296 | ** Fix DOS support (I can't do this myself). Note that the current |
297 | state of DOS-specific source files in the multi-tty tree are not | |
298 | useful; before starting work on DOS support, revert to pristine, | |
299 | pre-multi-tty versions. | |
7b00d185 KL |
300 | |
301 | ** Do a grep on XXX and ?? for more issues. | |
302 | ||
d3c554a0 KL |
303 | ** Understand Emacs's low-level input system (it's black magic) :-) |
304 | What exactly does interrupt_input do? I tried to disable it for | |
305 | raw secondary tty support, but it does not seem to do anything | |
306 | useful. (Update: Look again. X unconditionally enables this, maybe | |
307 | that's why raw terminal support is broken again. I really do need | |
308 | to understand input.) | |
7b00d185 | 309 | |
2246281f KL |
310 | ** Maybe standard-display-table should be display-local. |
311 | ||
6548cf00 KL |
312 | DIARY OF CHANGES |
313 | ---------------- | |
314 | ||
315 | (ex-TODO items with explanations.) | |
28d440ab | 316 | |
114a8b8c | 317 | -- Introduce a new struct for terminal devices. |
28d440ab | 318 | |
daf01701 | 319 | (Done, see struct tty_output. The list of members is not yet |
28d440ab KL |
320 | complete.) |
321 | ||
28d440ab KL |
322 | -- Change the bootstrap procedure to initialize tty_list. |
323 | ||
324 | (Done, but needs review.) | |
325 | ||
28d440ab KL |
326 | -- Change make-terminal-frame to support specifying another tty. |
327 | ||
328 | (Done, new frame parameters: `tty' and `tty-type'.) | |
329 | ||
9628b887 KL |
330 | -- Implement support for reading from multiple terminals. |
331 | ||
332 | (Done, read_avail_input tries to read from each terminal, until one | |
28d7d09f | 333 | succeeds. MULTI_KBOARD is not used. Secondary terminals don't send |
6548cf00 | 334 | SIGIO!) |
9628b887 | 335 | |
819b8f00 KL |
336 | (Update: They do, now.) |
337 | ||
daf01701 KL |
338 | (Update2: After enabling X, they don't.) |
339 | ||
9628b887 | 340 | -- other-frame should cycle through the frames on the `current' |
114a8b8c | 341 | terminal only. |
9628b887 | 342 | |
6548cf00 | 343 | (Done, by trivially modifiying next_frame and prev_frame.) |
9628b887 KL |
344 | |
345 | -- Support different terminal sizes. | |
114a8b8c | 346 | |
9628b887 KL |
347 | (Done, no problem.) |
348 | ||
349 | -- Make sure terminal resizes are handled gracefully. (Could be | |
350 | problematic.) | |
351 | ||
6548cf00 KL |
352 | (Done. We don't get automatic SIGWINCH for additional ttys, |
353 | though.) | |
9628b887 KL |
354 | |
355 | -- Extend emacsclient to automatically open a new tty when it connects | |
356 | to Emacs. | |
114a8b8c | 357 | |
9628b887 KL |
358 | (Done. It's an ugly hack, needs more work.) |
359 | ||
52c2ee2a KL |
360 | -- Redisplay must refresh the topmost frame on *all* terminals, not |
361 | just the initial terminal. | |
114a8b8c | 362 | |
52c2ee2a | 363 | (Done, but introduced an ugly redisplay problems. Ugh.) |
9628b887 | 364 | |
6548cf00 KL |
365 | -- Fix redisplay problems. |
366 | ||
52c2ee2a KL |
367 | (Done; it turned out that the entire Wcm structure must be moved |
368 | inside tty_output. Why didn't I catch this earlier?) | |
6548cf00 KL |
369 | |
370 | -- Provide a way for emacsclient to tell Emacs that the tty has been | |
371 | resized. | |
372 | ||
373 | (Done, simply forward the SIGWINCH signal.) | |
374 | ||
375 | -- Each keypress should automatically select the frame corresponding | |
376 | to the terminal that it was coming from. This means that Emacs | |
377 | must know from which terminal the last keyboard event came from. | |
6548cf00 | 378 | |
52c2ee2a KL |
379 | (Done, it was quite simple, the input event system already |
380 | supported multiple frames.) | |
6548cf00 KL |
381 | |
382 | -- Fix SIGIO issue with secondary terminals. | |
383 | ||
384 | (Done, emacsclient signals Emacs after writing to the proxy pseudo | |
52c2ee2a KL |
385 | terminal. Note that this means that multi-tty does not work with |
386 | raw ttys!) | |
28d440ab | 387 | |
0a125897 KL |
388 | (Update: This is bullshit. There is a read_input_waiting function, |
389 | extend that somehow.) | |
390 | ||
819b8f00 KL |
391 | (Update of update: The first update was not right either, extending |
392 | read_input_waiting was not necessary. Secondary ttys do seem to | |
393 | send signals on input.) | |
394 | ||
daf01701 KL |
395 | (Update^3: Not any more.) |
396 | ||
fca177d4 KL |
397 | -- Make make-terminal-frame look up the `tty' and `tty-type' frame |
398 | parameters from the currently selected terminal before the global | |
399 | default. | |
400 | ||
401 | (Done.) | |
402 | ||
403 | -- Put all cached terminal escape sequences into struct tty_output. | |
404 | Currently, they are still stored in global variables, so we don't | |
405 | really support multiple terminal types. | |
406 | ||
52c2ee2a | 407 | (Done. It was not fun.) |
fca177d4 KL |
408 | |
409 | -- Implement sane error handling after initialization. (Currently | |
6548cf00 KL |
410 | emacs exits if you specify a bad terminal type.) The helpful error |
411 | messages must still be provided when Emacs starts. | |
412 | ||
fca177d4 KL |
413 | (Done.) |
414 | ||
415 | -- Implement terminal deletion, i.e., deleting local frames, closing | |
416 | the tty device and restoring its previous state without exiting | |
417 | Emacs. | |
9628b887 | 418 | |
fca177d4 KL |
419 | (Done, but at the moment only called when an error happens during |
420 | initialization. There is a memory corruption error around this | |
daf01701 | 421 | somewhere.) (Update: now it is fully enabled.) |
fca177d4 | 422 | |
8303ba32 KL |
423 | -- Implement automatic deletion of terminals when the last frame on |
424 | that terminal is closed. | |
425 | ||
426 | (Done.) | |
427 | ||
0a125897 KL |
428 | -- Restore tty screen after closing the terminal. |
429 | ||
430 | (Done, we do the same as Emacs 21.2 for all terminals.) | |
431 | ||
432 | -- 'TERM=dumb src/emacs' does not restore the terminal state. | |
114a8b8c | 433 | |
0a125897 | 434 | (Done.) |
fca177d4 | 435 | |
b2af72d2 KL |
436 | -- C-g should work on secondary terminals. |
437 | ||
438 | (Done, but the binding is not configurable.) | |
439 | ||
440 | -- Deal with SIGHUP in Emacs and in emacsclient. (After this, the | |
441 | server-frames may be removed from server.el.) | |
442 | ||
443 | (Done, nothing to do. It seems that Emacs does not receive SIGHUP | |
daf01701 | 444 | from secondary ttys, which is actually a good thing.) (Update: I |
7b00d185 | 445 | think it would be a bad idea to remove server-frames.) |
b2af72d2 | 446 | |
daf01701 | 447 | -- Change emacsclient/server.el to support the -t argument better, |
b2af72d2 KL |
448 | i.e. automatically close the socket when the frame is closed. |
449 | ||
450 | (Seems to be working OK.) | |
451 | ||
16c290d8 | 452 | -- Fix mysterious memory corruption error with tty deletion. To |
fca177d4 KL |
453 | trigger it, try the following shell command: |
454 | ||
455 | while true; do TERM=no-such-terminal-definition emacsclient -h; done | |
456 | ||
457 | Emacs usually dumps core after a few dozen iterations. (The bug | |
3224dac1 | 458 | seems to be related to the xfreeing or bzeroing of |
9d9f1812 KL |
459 | tty_output.Wcm. Maybe there are outside references to struct Wcm? |
460 | Why were these vars collected into a struct before multi-tty | |
461 | support?) | |
fca177d4 | 462 | |
16c290d8 KL |
463 | (Done. Whew. It turned out that the problem had nothing to do |
464 | with hypothetical external references to Wcm, or any other | |
465 | tty_output component; it was simply that delete_tty closed the | |
466 | filehandles of secondary ttys twice, resulting in fclose doubly | |
3224dac1 | 467 | freeing memory. Utterly trivial matter. I love the C's memory |
16c290d8 KL |
468 | management, it puts hair on your chest.) |
469 | ||
819b8f00 | 470 | -- Support raw secondary terminals. (Note that SIGIO works only on |
3224dac1 | 471 | the controlling terminal.) Hint: extend read_input_waiting for |
819b8f00 | 472 | multiple ttys and hopefully this will be fixed. |
fca177d4 | 473 | |
819b8f00 KL |
474 | (Done, it seems to have been working already for some time. It |
475 | seems F_SETOWN does work, after all. Not sure what made it fail | |
476 | earlier, but it seems to be fixed (there were several changes | |
477 | around request_sigio, maybe one of them did it). | |
3224dac1 | 478 | read_input_waiting is only used in sys_select, don't change |
daf01701 | 479 | it.) (Update: After adding X support, it's broken again.) |
d3c554a0 | 480 | (Update^2: No it isn't.) :-) |
c1c63edb | 481 | |
819b8f00 | 482 | -- Find out why does Emacs abort when it wants to close its |
0a125897 | 483 | controlling tty. Hint: chan_process[] array. Hey, maybe |
16c290d8 KL |
484 | noninterrupt-IO would work, too? Update: no, there is no process |
485 | for stdin/out. | |
c33d2d42 | 486 | |
819b8f00 KL |
487 | (Done. Added add/delete_keyboard_wait_descriptor to |
488 | term_init/delete_tty. The hint was right, in a way.) | |
6548cf00 | 489 | |
819b8f00 | 490 | -- Issue with SIGIO: it needs to be disabled during redisplay. See if |
3224dac1 | 491 | fcntl kernel behaviour could be emulated by emacsclient. |
0a125897 | 492 | |
819b8f00 | 493 | (Done. Simply disabled the SIGIO emulation hack in emacsclient.) |
d3c554a0 | 494 | (Update: it was added back.) (Update^2: and removed again.) |
22de1e79 | 495 | |
819b8f00 | 496 | -- server.el: There are issues with saving files in buffers of closed |
16c290d8 KL |
497 | clients. Try editing a file with emacsclient -f, and (without |
498 | saving it) do a delete-frame. The frame is closed without | |
499 | question, and a surprising confirmation prompt appears in another | |
500 | frame. | |
501 | ||
819b8f00 KL |
502 | (Done. delete-frame now asks for confirmation if it still has |
503 | pending buffers, and modified buffers don't seem to be deleted.) | |
504 | ||
505 | -- emacsclient.el, server.el: Handle eval or file open errors when | |
daf01701 | 506 | doing -t. |
16c290d8 | 507 | |
819b8f00 | 508 | (Done.) |
22de1e79 | 509 | |
819b8f00 KL |
510 | -- Make parts of struct tty_output accessible from Lisp. The device |
511 | name and the type is sufficient. | |
22de1e79 | 512 | |
819b8f00 KL |
513 | (Done, see frame-tty-name and frame-tty-type.) |
514 | ||
515 | -- Export delete_tty to the Lisp environment, for emacsclient. | |
22de1e79 | 516 | |
819b8f00 KL |
517 | (Done, see delete-tty.) |
518 | ||
daf01701 KL |
519 | -- Get rid of the accessor macros in termchar.h, or define macros for |
520 | all members. | |
521 | ||
522 | (Done.) | |
523 | ||
524 | -- Move device-specific parameters (like costs) commonly used by | |
525 | device backends to a common, device-dependent structure. | |
526 | ||
527 | (Done. See struct display_method in termhooks.h.) | |
528 | ||
529 | -- Fix X support. | |
530 | ||
531 | (Done. Well, it seems to be working.) | |
532 | ||
533 | -- Allow simultaneous X and tty frames. (Handling input could be | |
534 | tricky. Or maybe not.) | |
535 | ||
536 | (Done. Allowed, that is. It is currently extremely unstable, to | |
537 | the point of being unusable. The rif variable causes constant | |
538 | core dumps. Handling input is indeed tricky.) | |
819b8f00 | 539 | |
7b00d185 | 540 | -- Rewrite multi-tty input in terms of MULTI_KBOARD. |
28d440ab | 541 | |
7b00d185 KL |
542 | (Done. In fact, there was no need to rewrite anything, I just |
543 | added a kboard member to tty_display_info, and initialized the | |
544 | frame's kboard from there.) | |
819b8f00 | 545 | |
fa971ac3 KL |
546 | -- Fix rif issue with X-tty combo sessions. IMHO the best thing to do |
547 | is to get rid of that global variable (and use the value value in | |
548 | display_method, which is guaranteed to be correct). | |
549 | ||
550 | (Done, did exactly that. Core dumps during combo sessions became | |
551 | much rarer. In fact, I have not yet met a single one.) | |
552 | ||
17086732 KL |
553 | -- Add multi-tty support to talk.el. |
554 | ||
555 | (Done.) | |
556 | ||
428a555e KL |
557 | -- Clean up the source of emacsclient. It is a mess. |
558 | ||
559 | (Done, eliminated stupid proxy-pty kludge.) | |
560 | ||
561 | -- Fix faces on tty frames during X-tty combo sessions. There is an | |
562 | init_frame_faces call in init_sys_modes, see if there is a problem | |
563 | with it. | |
564 | ||
565 | (Done, there was a stupid mistake in | |
566 | Ftty_supports_face_attributes_p. Colors are broken, though.) | |
567 | ||
568 | -- C-x 5 2, C-x 5 o, C-x 5 0 on an emacsclient frame unexpectedly | |
569 | exits emacsclient. This is a result of trying to be clever with | |
570 | delete-frame-functions. | |
571 | ||
572 | (Fixed, added delete-tty-after-functions, and changed server.el to | |
573 | use it.) | |
574 | ||
575 | -- Something with (maybe) multi-keyboard support broke function keys | |
576 | and arrows on ttys during X+tty combo sessions. Debug this. | |
577 | ||
578 | (I can't reproduce it, maybe the terminal type was wrong.) | |
579 | ||
580 | -- Fix input from raw ttys (again). | |
581 | ||
582 | (Now it seems to work all right.) | |
583 | ||
584 | -- During an X-tty combo session, a (message "Hello") from a tty frame | |
585 | goes to the X frame. Fix this. | |
586 | ||
587 | (Done. There was a safeguard against writing to the initial | |
588 | terminal frame during bootstrap which prevented echo_area_display | |
589 | from working correctly on a tty frame during a combo session.) | |
590 | ||
114a8b8c | 591 | -- If there are no frames on its controlling terminal, Emacs should |
d3c554a0 | 592 | exit if the user presses C-c there. |
114a8b8c KL |
593 | |
594 | (Done, as far as possible. See the SIGTERM comment in | |
595 | interrupt_signal on why this seems to be impossible to solve this | |
596 | in general.) | |
597 | ||
598 | -- During an X session, Emacs seems to read from stdin. Also, Emacs | |
599 | fails to start without a controlling tty. | |
600 | ||
601 | (Fixed by replacing the troublesome termcap display with a dummy | |
602 | bootstrap display during bootstrap. | |
603 | ||
604 | -- Do tty output through struct display, like graphical display | |
605 | backends. | |
606 | ||
607 | (Done.) | |
608 | ||
609 | -- Define an output_initial value for output_method for the initial | |
610 | frame that is dumped with Emacs. Checking for this frame (e.g. in | |
611 | cmd_error_internal) is ugly. | |
612 | ||
613 | (Done, broking interactive temacs.) | |
614 | ||
615 | -- The command `emacsclient -t -e '(delete-frame)'' fails to exit. | |
616 | ||
617 | (Fixed.) | |
618 | ||
4ca927b4 KL |
619 | -- frame-creation-function should always create a frame that is on the |
620 | same display as the selected frame. Maybe frame-creation-function | |
621 | should simply be removed and make-frame changed to do the right | |
622 | thing. | |
623 | ||
624 | (Done, with a nice hack. frame-creation-function is now frame-local.) | |
625 | ||
626 | -- Fix C-g on raw ttys. | |
627 | ||
628 | (Done. I disabled the interrupt/quit keys on all secondary | |
629 | terminals, so Emacs sees C-g as normal input. This looks like an | |
630 | overkill, because emacsclient has extra code to pass SIGINT to | |
631 | Emacs, so C-g should remain the interrupt/quit key on emacsclient | |
632 | frames. See the next entry why implementing this distinction would | |
633 | be a bad idea.) | |
634 | ||
635 | -- Make sure C-g goes to the right frame with ttys. This is hard, as | |
636 | SIGINT doesn't have a tty parameter. :-( | |
637 | ||
638 | (Done, the previous change fixes this as a pleasant side effect.) | |
639 | ||
c0707982 KL |
640 | -- I have seen a case when Emacs with multiple ttys fell into a loop |
641 | eating 100% of CPU time. Strace showed this loop: | |
642 | ||
643 | getpid() = 30284 | |
644 | kill(30284, SIGIO) = 0 | |
645 | --- SIGIO (I/O possible) @ 0 (0) --- | |
646 | ioctl(6, FIONREAD, [0]) = -1 EIO (Input/output error) | |
647 | ioctl(5, FIONREAD, [0]) = -1 EIO (Input/output error) | |
648 | ioctl(0, FIONREAD, [0]) = 0 | |
649 | sigreturn() = ? (mask now []) | |
650 | gettimeofday({1072842297, 747760}, NULL) = 0 | |
651 | gettimeofday({1072842297, 747806}, NULL) = 0 | |
652 | select(9, [0 3 5 6], NULL, NULL, {0, 0}) = 2 (in [5 6], left {0, 0}) | |
653 | select(9, [0 3 5 6], NULL, NULL, {0, 0}) = 2 (in [5 6], left {0, 0}) | |
654 | gettimeofday({1072842297, 748245}, NULL) = 0 | |
655 | ||
656 | I have seen something similar with a single X frame, but have not | |
657 | been able to reproduce it for debugging. | |
658 | ||
659 | Update: This may have been caused by checking for nread != 0 | |
660 | instead of nread > 0 after calling read_socket_hook in | |
661 | read_avail_input. | |
662 | ||
663 | (Fixed. This was caused by unconditionally including stdin in | |
664 | input_wait_mask in init_process. The select call in | |
665 | wait_reading_process_input always returned immediately, indicating | |
666 | that there is pending input from stdin, which nobody read. | |
667 | ||
668 | Note that the above strace output seems to be an unrelated but | |
669 | similar bug. I think that is now fixed.) | |
4ca927b4 | 670 | |
2246281f KL |
671 | -- Exiting Emacs while there are emacsclient frames doesn't restore the |
672 | ttys to their default states. | |
673 | ||
674 | (This seems to be fixed by some previous change.) | |
675 | ||
676 | -- Allow opening an X session after -nw. | |
677 | ||
678 | (Done.) | |
679 | ||
d448e982 KL |
680 | -- Fix color handling during tty+X combo sessions. (It seems that tty |
681 | sessions automatically convert the face colors to terminal colors | |
682 | when the face is loaded. This conversion must happen instead on | |
683 | the fly in write_glyphs, which might be problematic, as color | |
684 | approximation is currently done in lisp (term/tty-colors.el).) | |
685 | (Update: hm, colors seem to work fine if I start emacs with -nw and | |
686 | then create an X frame. Maybe it's just a small buglet somewhere.) | |
687 | ||
688 | (Seems to be fixed. The problem was in startup.el, it did not | |
689 | initialize tty colors when the initial window system was | |
690 | graphical.) | |
2246281f | 691 | |
2441679b KL |
692 | -- emacs -nw --eval '(y-or-n-p "Foobar")' segfaults. (Reported by |
693 | Romain Francoise) | |
694 | ||
695 | (Fixed, there was a keyboard initialization problem.) | |
696 | ||
3bbdbec9 KL |
697 | -- Fix interactive use of temacs. There are face-related SEGVs, most |
698 | likely because of changes in realize_default_face, realize_face. | |
699 | ||
700 | (Fixed.) | |
701 | ||
bacb6689 KL |
702 | -- Don't exit Emacs when the last X connection fails during a |
703 | multi-display session. | |
704 | ||
705 | (Fixed.) | |
706 | ||
0c72d684 KL |
707 | -- Dan Nicolaescu noticed that starting emacsclient on the same |
708 | terminal device that is the controlling tty of the Emacs process | |
709 | gives unexpected results. | |
710 | ||
711 | (Fixed.) | |
712 | ||
4edd8a5c KL |
713 | -- Istvan Marko reported that Emacs hang on ttys if it was started |
714 | from a shell script. | |
715 | ||
716 | (Fixed. There was a bug in the multi-tty version of | |
717 | narrow_foreground_group. tcsetpgrp blocks if it is called from a | |
718 | process that is not in the same process group as the tty.) | |
719 | ||
2fc0cf2a KL |
720 | -- emacsclient -t from an Emacs term buffer does not work, complains |
721 | about face problems. This can even lock up Emacs (if the recursive | |
722 | frame sets single_kboard). Update: the face problems are caused by | |
723 | bugs in term.el, not in multi-tty. The lockup is caused by | |
d3c554a0 | 724 | single_kboard mode, and is not easily resolvable. The best thing to |
2fc0cf2a KL |
725 | do is to simply refuse to create a tty frame of type `eterm'. |
726 | ||
727 | (Fixed, changed emacsclient to check for TERM=eterm. The face | |
728 | complaints seem to be caused by bugs in term.el; they are not | |
729 | related to multi-tty.) | |
730 | ||
0b0d3e0b KL |
731 | -- Find out the best way to support suspending Emacs with multiple |
732 | ttys. My guess: disable it on the controlling tty, but from other | |
733 | ttys pass it on to emacsclient somehow. (It is (I hope) trivial to | |
734 | extend emacsclient to handle suspend/resume. A `kill -STOP' almost | |
735 | works right now.) | |
736 | ||
737 | (Done. I needed to play with signal handling and the server | |
738 | protocol a bit to make emacsclient behave as a normal UNIX program | |
739 | wrt foreground/background process groups.) | |
740 | ||
eb1f46c9 KL |
741 | -- There is a flicker during the startup of `emacs -nw'; it's as if |
742 | the terminal is initialized, reset and then initialialized again. | |
743 | Debug this. (Hint: narrow_foreground_group is called twice during | |
744 | startup.) | |
745 | ||
746 | (This is gone.) | |
747 | ||
026ad6ba KL |
748 | -- Robert Chassell has found serious copy-paste bugs with the |
749 | multi-tty branch. There seem to be redisplay bugs while copying | |
750 | from X to a terminal frame. Copying accented characters do not | |
751 | work for me. | |
752 | ||
753 | (Patch-124 should fix this, by changing the interprogram-*-function | |
754 | variables to be frame-local, as suggested by Mark Plaksin | |
755 | (thanks!). I think that the redisplay bugs are in fact not bugs, | |
756 | but delays caused by single_kboard --> perhaps MULTI_KBOARD should | |
757 | be removed.) | |
758 | ||
759 | ||
0b0d3e0b | 760 | |
28d440ab | 761 | ;;; arch-tag: 8da1619e-2e79-41a8-9ac9-a0485daad17d |