comparison README.multi-tty @ 83300:6deb860255f3

Support for ttys with different character locale settings. * lisp/server.el (server-process-filter): Set locale environment variables from client while creating tty frames. * lisp/faces.el (tty-create-frame-with-faces): Call set-locale-environment. * lisp/international/mule-cmds.el (set-display-table-and-terminal-coding-system): Add DISPLAY parameter. Pass it to set-terminal-coding-system. (set-locale-environment): Add DISPLAY parameter. git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-340
author Karoly Lorentey <lorentey@elte.hu>
date Tue, 03 May 2005 03:01:09 +0000
parents ed09a89e2b25
children 666b48e39a5a
comparison
equal deleted inserted replaced
83299:4a6a96fe8480 83300:6deb860255f3
255 crashes, or the network connection times out, or whatever. (I had an 255 crashes, or the network connection times out, or whatever. (I had an
256 extremely unstable X server for some time while I was developing these 256 extremely unstable X server for some time while I was developing these
257 patches, and running Emacs this way has saved me a number of M-x 257 patches, and running Emacs this way has saved me a number of M-x
258 recover-session invocations.) 258 recover-session invocations.)
259 259
260 I use the following two bash functions to handle my Emacs sessions: 260 I use the following two bash scripts to handle my Emacs sessions:
261 261
262 ,----[ ~/.bash_profile 262 -------------------------------------------------------connect-emacs--
263 | # Usage: preload_emacs <name> [<waitp>] 263 #!/bin/bash
264 | # 264 # Usage: connect-emacs <name> <args>...
265 | # Preloads the Emacs instance called NAME in a detached screen 265 #
266 | # session. Does nothing if the instance is already running. If WAITP 266 # Connects to the Emacs instance called NAME. Starts up the instance
267 | # is non-empty, the function waits until the server starts up and 267 # if it is not already running. The rest of the arguments are passed
268 | # creates its socket; otherwise it returns immediately. 268 # to emacsclient.
269 | function preload_emacs { 269
270 | local name="$1" 270 name="$1"
271 | local waitp="$2" 271 shift
272 | local screendir="/var/run/screen/S-$USER" 272
273 | local serverdir="/tmp/emacs$UID" 273 if [ -z "$name" ]; then
274 | local emacs=emacs # Or wherever you installed your multi-tty Emacs 274 echo "Usage: connect_emacs <name> <args>..." >&2
275 | 275 exit 1
276 | if [ -z "$name" ]; then 276 fi
277 | echo "Usage: preload_emacs <name> [<waitp>]" >&2 277 preload-emacs "$name" wait
278 | return 1 278 /usr/bin/emacsclient.emacs-multi-tty -s "$name" "$@"
279 | fi 279 ----------------------------------------------------------------------
280 | 280
281 | if [ ! -e "$screendir"/*."$name" ]; then 281 -------------------------------------------------------preload-emacs--
282 | if [ -e "$serverdir/$name" ]; then 282 #!/bin/bash
283 | # Delete leftover socket (for the wait option) 283 # Usage: preload-emacs <name> [<waitp>]
284 | rm "$serverdir/$name" 284 #
285 | fi 285 # Preloads the Emacs instance called NAME in a detached screen
286 | screen -dmS "$name" "$emacs" -nw --eval "(setq server-name \"$name\")" -f server-start 286 # session. Does nothing if the instance is already running. If WAITP
287 | fi 287 # is non-empty, the function waits until the server starts up and
288 | if [ ! -z "$waitp" ]; then 288 # creates its socket; otherwise it returns immediately.
289 | while [ ! -e "$serverdir/$name" ]; do sleep 0.1; done 289
290 | fi 290 name="$1"
291 | return 0 291 waitp="$2"
292 | } 292 screendir="/var/run/screen/S-$USER"
293 | 293 serverdir="/tmp/emacs$UID"
294 | # Usage: connect_emacs <name> <args>... 294 emacs=/usr/bin/emacs-multi-tty # Or wherever you installed your multi-tty Emacs
295 | # 295
296 | # Connects to the Emacs instance called NAME. Starts up the instance 296 if [ -z "$name" ]; then
297 | # if it is not already running. The rest of the arguments are passed 297 echo "Usage: preload_emacs <name> [<waitp>]" >&2
298 | # to emacsclient. 298 exit 1
299 | function connect_emacs { 299 fi
300 | local name="$1" 300
301 | shift 301 if [ ! -e "$screendir"/*."$name" ]; then
302 | 302 if [ -e "$serverdir/$name" ]; then
303 | if [ -z "$name" ]; then 303 # Delete leftover socket (for the wait option)
304 | echo "Usage: connect_emacs <name> <args>..." >&2 304 rm "$serverdir/$name"
305 | fi 305 fi
306 | preload_emacs "$name" wait 306 screen -dmS "$name" "$emacs" -nw --eval "(setq server-name \"$name\")" -f server-start
307 | emacsclient -s "$name" "$@" 307 fi
308 | } 308 if [ ! -z "$waitp" ]; then
309 | 309 while [ ! -e "$serverdir/$name" ]; do sleep 0.1; done
310 | export -f preload_emacs connect_emacs 310 fi
311 | 311 ----------------------------------------------------------------------
312 | # Preload editor and gnus sessions for speedy initial connects. 312
313 | preload_emacs editor 313 I have the following in my profile to have two instances automatically
314 | preload_emacs gnus 314 preloaded for editing and email:
315 `---- 315
316 316 preload-emacs editor
317 ,----[ ~/.bashrc 317 preload-emacs gnus
318 | alias gnus="connect_emacs gnus" 318
319 | alias edit="connect_emacs editor" 319 It is useful to set up short aliases for connect-emacs. I use the
320 | alias et="connect_emacs editor -t" 320 following:
321 | alias e=edit 321
322 `---- 322 alias edit="connect-emacs editor"
323 alias e=edit
324 alias et="connect-emacs editor -t"
325 alias gnus="connect-emacs gnus"
323 326
324 327
325 NEWS 328 NEWS
326 ---- 329 ----
327 330
404 to accept display ids. 407 to accept display ids.
405 408
406 ** rif->flush_display_optional (NULL) calls should be replaced by a 409 ** rif->flush_display_optional (NULL) calls should be replaced by a
407 new global function. 410 new global function.
408 411
409 ** Support multiple character locales. 412 ** The set-locale-environment hack (adding the DISPLAY option) should
410 413 be replaced with a clean design.
411 (1) A version of `set-locale-environment' needs to be written 414
412 for setting up display-local settings on ttys. I think 415 ** standard-display-table should be display-local.
413 calling set-display-table-and-terminal-coding-system and 416 standard-display-european should be display-local.
414 set-keyboard-coding-system would be enough. The language
415 environment itself should remain a global setting.
416
417 (2) Have a look at Vlocale_coding_system. Seems like it would
418 be a tedious job to localize it, although most references
419 use it for interfacing with libc and are therefore OK with
420 the global definition.
421
422 Exceptions found so far: x-select-text and
423 x-cut-buffer-or-selection-value.
424
425 ** Have a look at fatal_error_hook.
426
427 ** Have a look at set_frame_matrix_frame.
428
429 ** Check if we got term-setup-hook right.
430
431 ** I think tip_frame should be display-local.
432
433 ** Check display reference count handling in x_create_tip_frame.
434
435 ** make-frame does not correctly handle extra parameters in its
436 argument:
437
438 (frame-parameter (make-frame (list (cons 'foobar 42))) 'foobar)
439 => nil
440
441 (This is likely an error in the CVS trunk.)
442 417
443 ** Fix set-input-mode for multi-tty. It's a truly horrible interface; 418 ** Fix set-input-mode for multi-tty. It's a truly horrible interface;
444 what if we'd blow it up into several separate functions (with a 419 what if we'd blow it up into several separate functions (with a
445 compatibility definition)? 420 compatibility definition)?
421
422 ** Have a look at Vlocale_coding_system. Seems like it would be a
423 tedious job to localize it, although most references use it for
424 interfacing with libc and are therefore OK with the global
425 definition.
426
427 Exceptions found so far: x-select-text and
428 x-cut-buffer-or-selection-value.
429
430 ** Have a look at fatal_error_hook.
431
432 ** Have a look at set_frame_matrix_frame.
433
434 ** Check if we got term-setup-hook right.
435
436 ** I think tip_frame should be display-local.
437
438 ** Check display reference count handling in x_create_tip_frame.
439
440 ** make-frame does not correctly handle extra parameters in its
441 argument:
442
443 (frame-parameter (make-frame (list (cons 'foobar 42))) 'foobar)
444 => nil
445
446 (This is likely an error in the CVS trunk.)
446 447
447 ** The terminal customization files in term/*.el tend to change global 448 ** The terminal customization files in term/*.el tend to change global
448 parameters, which may confuse Emacs with multiple displays. Change 449 parameters, which may confuse Emacs with multiple displays. Change
449 them to tweak only frame-local settings, if possible. (They tend 450 them to tweak only frame-local settings, if possible. (They tend
450 to call define-key to set function key sequences a lot.) 451 to call define-key to set function key sequences a lot.)
494 What exactly does interrupt_input do? I tried to disable it for 495 What exactly does interrupt_input do? I tried to disable it for
495 raw secondary tty support, but it does not seem to do anything 496 raw secondary tty support, but it does not seem to do anything
496 useful. (Update: Look again. X unconditionally enables this, maybe 497 useful. (Update: Look again. X unconditionally enables this, maybe
497 that's why raw terminal support is broken again. I really do need 498 that's why raw terminal support is broken again. I really do need
498 to understand input.) 499 to understand input.)
499
500 ** Maybe standard-display-table should be display-local.
501 500
502 DIARY OF CHANGES 501 DIARY OF CHANGES
503 ---------------- 502 ----------------
504 503
505 (ex-TODO items with explanations.) 504 (ex-TODO items with explanations.)
1040 -- Clean up the frame-local variable system. I think it's ugly and 1039 -- Clean up the frame-local variable system. I think it's ugly and
1041 error-prone. But maybe I just haven't yet fully understood it. 1040 error-prone. But maybe I just haven't yet fully understood it.
1042 1041
1043 (Nothing to do. It doesn't seem ugly any more. It's rather clever.) 1042 (Nothing to do. It doesn't seem ugly any more. It's rather clever.)
1044 1043
1044 -- Support multiple character locales. A version of
1045 `set-locale-environment' needs to be written for setting up
1046 display-local settings on ttys. I think calling
1047 set-display-table-and-terminal-coding-system and
1048 set-keyboard-coding-system would be enough. The language
1049 environment itself should remain a global setting.
1050
1051 (Done, by an ugly hack.)
1052
1045 ;;; arch-tag: 8da1619e-2e79-41a8-9ac9-a0485daad17d 1053 ;;; arch-tag: 8da1619e-2e79-41a8-9ac9-a0485daad17d