diff src/coding.c @ 83127:5182815e0ee1

Make terminal_coding and keyboard_coding display-local. src/coding.c: Include frame.h and termhooks.h. (terminal_coding, keyboard_coding): Remove. (Fset_terminal_coding_system_internal, Fterminal_coding_system): Use the selected frame's terminal coding system. (Fset_safe_terminal_coding_system_internal): Fix typo. (Fset_keyboard_coding_system_internal, Fkeyboard_coding_system): Use the selected frame's keyboard coding system. (init_coding_once): Don't initialize keyboard_coding and terminal_coding. src/coding.h (terminal_coding, keyboard_coding): Remove. src/termhooks.h (terminal_coding, keyboard_coding): New members of struct display. (FRAME_TERMINAL_CODING, FRAME_KEYBOARD_CODING): New macros. src/termchar.h (kboard): Cosmetic change. src/term.c (encode_terminal_code): Add coding parameter. (tty_write_glyphs): Use the display-local terminal coding system. (create_display): Allocate and initialize coding systems. (delete_display): Free coding systems. src/xdisp.c (decode_mode_spec): Use display-local coding systems. src/Makefile.in: Fix dependencies for termchar.h and termhooks.h. git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-167
author Karoly Lorentey <lorentey@elte.hu>
date Sun, 23 May 2004 01:53:23 +0000
parents a7e59b39de35
children cf8f0a3b5cb4
line wrap: on
line diff
--- a/src/coding.c	Sat May 22 22:52:43 2004 +0000
+++ b/src/coding.c	Sun May 23 01:53:23 2004 +0000
@@ -346,6 +346,8 @@
 #include "coding.h"
 #include "window.h"
 #include "intervals.h"
+#include "frame.h"
+#include "termhooks.h"
 
 #else  /* not emacs */
 
@@ -428,16 +430,10 @@
 /* Flag to make buffer-file-coding-system inherit from process-coding.  */
 int inherit_process_coding_system;
 
-/* Coding system to be used to encode text for terminal display.  */
-struct coding_system terminal_coding;
-
 /* Coding system to be used to encode text for terminal display when
    terminal coding system is nil.  */
 struct coding_system safe_terminal_coding;
 
-/* Coding system of what is sent from terminal keyboard.  */
-struct coding_system keyboard_coding;
-
 /* Default coding system to be used to write a file.  */
 struct coding_system default_buffer_file_coding;
 
@@ -7184,16 +7180,17 @@
      (coding_system)
      Lisp_Object coding_system;
 {
+  struct coding_system *terminal_coding = FRAME_TERMINAL_CODING (SELECTED_FRAME ());
   CHECK_SYMBOL (coding_system);
-  setup_coding_system (Fcheck_coding_system (coding_system), &terminal_coding);
+  setup_coding_system (Fcheck_coding_system (coding_system), terminal_coding);
   /* We had better not send unsafe characters to terminal.  */
-  terminal_coding.mode |= CODING_MODE_INHIBIT_UNENCODABLE_CHAR;
+  terminal_coding->mode |= CODING_MODE_INHIBIT_UNENCODABLE_CHAR;
   /* Character composition should be disabled.  */
-  terminal_coding.composing = COMPOSITION_DISABLED;
+  terminal_coding->composing = COMPOSITION_DISABLED;
   /* Error notification should be suppressed.  */
-  terminal_coding.suppress_error = 1;
-  terminal_coding.src_multibyte = 1;
-  terminal_coding.dst_multibyte = 0;
+  terminal_coding->suppress_error = 1;
+  terminal_coding->src_multibyte = 1;
+  terminal_coding->dst_multibyte = 0;
   return Qnil;
 }
 
@@ -7209,7 +7206,7 @@
   /* Character composition should be disabled.  */
   safe_terminal_coding.composing = COMPOSITION_DISABLED;
   /* Error notification should be suppressed.  */
-  terminal_coding.suppress_error = 1;
+  safe_terminal_coding.suppress_error = 1;
   safe_terminal_coding.src_multibyte = 1;
   safe_terminal_coding.dst_multibyte = 0;
   return Qnil;
@@ -7220,7 +7217,7 @@
        doc: /* Return coding system specified for terminal output.  */)
      ()
 {
-  return terminal_coding.symbol;
+  return FRAME_TERMINAL_CODING (SELECTED_FRAME ())->symbol;
 }
 
 DEFUN ("set-keyboard-coding-system-internal", Fset_keyboard_coding_system_internal,
@@ -7230,9 +7227,10 @@
      Lisp_Object coding_system;
 {
   CHECK_SYMBOL (coding_system);
-  setup_coding_system (Fcheck_coding_system (coding_system), &keyboard_coding);
+  setup_coding_system (Fcheck_coding_system (coding_system),
+                       FRAME_KEYBOARD_CODING (SELECTED_FRAME ()));
   /* Character composition should be disabled.  */
-  keyboard_coding.composing = COMPOSITION_DISABLED;
+  FRAME_KEYBOARD_CODING (SELECTED_FRAME ())->composing = COMPOSITION_DISABLED;
   return Qnil;
 }
 
@@ -7241,7 +7239,7 @@
        doc: /* Return coding system specified for decoding keyboard input.  */)
      ()
 {
-  return keyboard_coding.symbol;
+  return FRAME_KEYBOARD_CODING (SELECTED_FRAME ())->symbol;
 }
 
 
@@ -7488,8 +7486,6 @@
   iso_code_class[ISO_CODE_SS3] = ISO_single_shift_3;
   iso_code_class[ISO_CODE_CSI] = ISO_control_sequence_introducer;
 
-  setup_coding_system (Qnil, &keyboard_coding);
-  setup_coding_system (Qnil, &terminal_coding);
   setup_coding_system (Qnil, &safe_terminal_coding);
   setup_coding_system (Qnil, &default_buffer_file_coding);