diff options
| author | Miles Bader | 2007-05-13 13:26:57 +0000 |
|---|---|---|
| committer | Miles Bader | 2007-05-13 13:26:57 +0000 |
| commit | 2ccf59411f334a41f2c64b1220a5d45f11071cae (patch) | |
| tree | 06557aa3117c2c13e011840d748c0f43111e7473 /src/coding.c | |
| parent | 68380acf41d91014634d625e5f529cd3f773fbd4 (diff) | |
| parent | d6897a018781164bf9e7bd4ca51c87b303170313 (diff) | |
| download | emacs-2ccf59411f334a41f2c64b1220a5d45f11071cae.tar.gz emacs-2ccf59411f334a41f2c64b1220a5d45f11071cae.zip | |
Import arch branch emacs@sv.gnu.org/emacs--multi-tty--0
Diffstat (limited to 'src/coding.c')
| -rw-r--r-- | src/coding.c | 62 |
1 files changed, 34 insertions, 28 deletions
diff --git a/src/coding.c b/src/coding.c index 6bb9f8225c9..8dc20ef6a3a 100644 --- a/src/coding.c +++ b/src/coding.c | |||
| @@ -351,6 +351,8 @@ encode_coding_XXX (coding, source, destination, src_bytes, dst_bytes) | |||
| 351 | #include "coding.h" | 351 | #include "coding.h" |
| 352 | #include "window.h" | 352 | #include "window.h" |
| 353 | #include "intervals.h" | 353 | #include "intervals.h" |
| 354 | #include "frame.h" | ||
| 355 | #include "termhooks.h" | ||
| 354 | 356 | ||
| 355 | #else /* not emacs */ | 357 | #else /* not emacs */ |
| 356 | 358 | ||
| @@ -436,16 +438,10 @@ int inhibit_iso_escape_detection; | |||
| 436 | /* Flag to make buffer-file-coding-system inherit from process-coding. */ | 438 | /* Flag to make buffer-file-coding-system inherit from process-coding. */ |
| 437 | int inherit_process_coding_system; | 439 | int inherit_process_coding_system; |
| 438 | 440 | ||
| 439 | /* Coding system to be used to encode text for terminal display. */ | ||
| 440 | struct coding_system terminal_coding; | ||
| 441 | |||
| 442 | /* Coding system to be used to encode text for terminal display when | 441 | /* Coding system to be used to encode text for terminal display when |
| 443 | terminal coding system is nil. */ | 442 | terminal coding system is nil. */ |
| 444 | struct coding_system safe_terminal_coding; | 443 | struct coding_system safe_terminal_coding; |
| 445 | 444 | ||
| 446 | /* Coding system of what is sent from terminal keyboard. */ | ||
| 447 | struct coding_system keyboard_coding; | ||
| 448 | |||
| 449 | /* Default coding system to be used to write a file. */ | 445 | /* Default coding system to be used to write a file. */ |
| 450 | struct coding_system default_buffer_file_coding; | 446 | struct coding_system default_buffer_file_coding; |
| 451 | 447 | ||
| @@ -7368,21 +7364,23 @@ Return the corresponding character code in Big5. */) | |||
| 7368 | } | 7364 | } |
| 7369 | 7365 | ||
| 7370 | DEFUN ("set-terminal-coding-system-internal", Fset_terminal_coding_system_internal, | 7366 | DEFUN ("set-terminal-coding-system-internal", Fset_terminal_coding_system_internal, |
| 7371 | Sset_terminal_coding_system_internal, 1, 1, 0, | 7367 | Sset_terminal_coding_system_internal, 1, 2, 0, |
| 7372 | doc: /* Internal use only. */) | 7368 | doc: /* Internal use only. */) |
| 7373 | (coding_system) | 7369 | (coding_system, terminal) |
| 7374 | Lisp_Object coding_system; | 7370 | Lisp_Object coding_system; |
| 7371 | Lisp_Object terminal; | ||
| 7375 | { | 7372 | { |
| 7373 | struct coding_system *terminal_coding = TERMINAL_TERMINAL_CODING (get_terminal (terminal, 1)); | ||
| 7376 | CHECK_SYMBOL (coding_system); | 7374 | CHECK_SYMBOL (coding_system); |
| 7377 | setup_coding_system (Fcheck_coding_system (coding_system), &terminal_coding); | 7375 | setup_coding_system (Fcheck_coding_system (coding_system), terminal_coding); |
| 7378 | /* We had better not send unsafe characters to terminal. */ | 7376 | /* We had better not send unsafe characters to terminal. */ |
| 7379 | terminal_coding.mode |= CODING_MODE_INHIBIT_UNENCODABLE_CHAR; | 7377 | terminal_coding->mode |= CODING_MODE_INHIBIT_UNENCODABLE_CHAR; |
| 7380 | /* Character composition should be disabled. */ | 7378 | /* Character composition should be disabled. */ |
| 7381 | terminal_coding.composing = COMPOSITION_DISABLED; | 7379 | terminal_coding->composing = COMPOSITION_DISABLED; |
| 7382 | /* Error notification should be suppressed. */ | 7380 | /* Error notification should be suppressed. */ |
| 7383 | terminal_coding.suppress_error = 1; | 7381 | terminal_coding->suppress_error = 1; |
| 7384 | terminal_coding.src_multibyte = 1; | 7382 | terminal_coding->src_multibyte = 1; |
| 7385 | terminal_coding.dst_multibyte = 0; | 7383 | terminal_coding->dst_multibyte = 0; |
| 7386 | return Qnil; | 7384 | return Qnil; |
| 7387 | } | 7385 | } |
| 7388 | 7386 | ||
| @@ -7405,32 +7403,42 @@ DEFUN ("set-safe-terminal-coding-system-internal", Fset_safe_terminal_coding_sys | |||
| 7405 | } | 7403 | } |
| 7406 | 7404 | ||
| 7407 | DEFUN ("terminal-coding-system", Fterminal_coding_system, | 7405 | DEFUN ("terminal-coding-system", Fterminal_coding_system, |
| 7408 | Sterminal_coding_system, 0, 0, 0, | 7406 | Sterminal_coding_system, 0, 1, 0, |
| 7409 | doc: /* Return coding system specified for terminal output. */) | 7407 | doc: /* Return coding system specified for terminal output on the given terminal. |
| 7410 | () | 7408 | TERMINAL may be a terminal id, a frame, or nil for the selected |
| 7409 | frame's terminal device. */) | ||
| 7410 | (terminal) | ||
| 7411 | Lisp_Object terminal; | ||
| 7411 | { | 7412 | { |
| 7412 | return terminal_coding.symbol; | 7413 | return TERMINAL_TERMINAL_CODING (get_terminal (terminal, 1))->symbol; |
| 7413 | } | 7414 | } |
| 7414 | 7415 | ||
| 7415 | DEFUN ("set-keyboard-coding-system-internal", Fset_keyboard_coding_system_internal, | 7416 | DEFUN ("set-keyboard-coding-system-internal", Fset_keyboard_coding_system_internal, |
| 7416 | Sset_keyboard_coding_system_internal, 1, 1, 0, | 7417 | Sset_keyboard_coding_system_internal, 1, 2, 0, |
| 7417 | doc: /* Internal use only. */) | 7418 | doc: /* Internal use only. */) |
| 7418 | (coding_system) | 7419 | (coding_system, terminal) |
| 7419 | Lisp_Object coding_system; | 7420 | Lisp_Object coding_system; |
| 7421 | Lisp_Object terminal; | ||
| 7420 | { | 7422 | { |
| 7423 | struct terminal *t = get_terminal (terminal, 1); | ||
| 7421 | CHECK_SYMBOL (coding_system); | 7424 | CHECK_SYMBOL (coding_system); |
| 7422 | setup_coding_system (Fcheck_coding_system (coding_system), &keyboard_coding); | 7425 | |
| 7426 | setup_coding_system (Fcheck_coding_system (coding_system), | ||
| 7427 | TERMINAL_KEYBOARD_CODING (t)); | ||
| 7423 | /* Character composition should be disabled. */ | 7428 | /* Character composition should be disabled. */ |
| 7424 | keyboard_coding.composing = COMPOSITION_DISABLED; | 7429 | TERMINAL_KEYBOARD_CODING (t)->composing = COMPOSITION_DISABLED; |
| 7425 | return Qnil; | 7430 | return Qnil; |
| 7426 | } | 7431 | } |
| 7427 | 7432 | ||
| 7428 | DEFUN ("keyboard-coding-system", Fkeyboard_coding_system, | 7433 | DEFUN ("keyboard-coding-system", Fkeyboard_coding_system, |
| 7429 | Skeyboard_coding_system, 0, 0, 0, | 7434 | Skeyboard_coding_system, 0, 1, 0, |
| 7430 | doc: /* Return coding system specified for decoding keyboard input. */) | 7435 | doc: /* Return coding system for decoding keyboard input on TERMINAL. |
| 7431 | () | 7436 | TERMINAL may be a terminal id, a frame, or nil for the selected |
| 7437 | frame's terminal device. */) | ||
| 7438 | (terminal) | ||
| 7439 | Lisp_Object terminal; | ||
| 7432 | { | 7440 | { |
| 7433 | return keyboard_coding.symbol; | 7441 | return TERMINAL_KEYBOARD_CODING (get_terminal (terminal, 1))->symbol; |
| 7434 | } | 7442 | } |
| 7435 | 7443 | ||
| 7436 | 7444 | ||
| @@ -7693,8 +7701,6 @@ init_coding_once () | |||
| 7693 | iso_code_class[ISO_CODE_SS3] = ISO_single_shift_3; | 7701 | iso_code_class[ISO_CODE_SS3] = ISO_single_shift_3; |
| 7694 | iso_code_class[ISO_CODE_CSI] = ISO_control_sequence_introducer; | 7702 | iso_code_class[ISO_CODE_CSI] = ISO_control_sequence_introducer; |
| 7695 | 7703 | ||
| 7696 | setup_coding_system (Qnil, &keyboard_coding); | ||
| 7697 | setup_coding_system (Qnil, &terminal_coding); | ||
| 7698 | setup_coding_system (Qnil, &safe_terminal_coding); | 7704 | setup_coding_system (Qnil, &safe_terminal_coding); |
| 7699 | setup_coding_system (Qnil, &default_buffer_file_coding); | 7705 | setup_coding_system (Qnil, &default_buffer_file_coding); |
| 7700 | 7706 | ||