diff src/data.c @ 83325:9e41c80c6389

Work around nondeterministic binding of terminal-local variables. (Fixes national character input on ttys.) * src/data.c (Fterminal_local_value, Fset_terminal_local_value): New functions. (syms_of_data): Defsubr them. * lisp/international/encoded-kb.el (encoded-kbd-setup-keymap): Add keymap parameter. Use it instead of changing key-translation-map directly. (encoded-kbd-setup-display): Use terminal-local-value and set-terminal-local-value to access key-translation-map. Remove debugging messages. * lisp/international/mule.el (keyboard-coding-system): Test for encoded-kbd-setup-display, not encoded-kbd-mode. * src/keyboard.c (syms_of_keyboard): Expand docs of terminal-local variables to warn about their random bindings. git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-365
author Karoly Lorentey <lorentey@elte.hu>
date Mon, 27 Jun 2005 02:08:34 +0000
parents a0e6e458f2fc
children 6c13700d1c13
line wrap: on
line diff
--- a/src/data.c	Mon Jun 27 00:57:09 2005 +0000
+++ b/src/data.c	Mon Jun 27 02:08:34 2005 +0000
@@ -1875,6 +1875,44 @@
 
   return Qnil;
 }
+
+extern struct display *get_display P_ ((Lisp_Object display, int));
+
+DEFUN ("terminal-local-value", Fterminal_local_value, Sterminal_local_value, 2, 2, 0,
+       doc: /* Return the terminal-local value of SYMBOL on DISPLAY.
+If SYMBOL is not a terminal-local variable, then return its normal
+value, like `symbol-value'.
+
+DISPLAY may be a display, a frame, or nil (meaning the selected
+frame's display).  */)
+  (symbol, display)
+     Lisp_Object symbol;
+     Lisp_Object display;
+{
+  Lisp_Object result;
+  struct display *d = get_display (display, 1);
+  push_display_kboard (d);
+  result = Fsymbol_value (symbol);
+  pop_frame_kboard ();
+  return result;
+}
+
+DEFUN ("set-terminal-local-value", Fset_terminal_local_value, Sset_terminal_local_value, 3, 3, 0,
+       doc: /* Set the terminal-local binding of SYMBOL on DISPLAY to VALUE.
+If VARIABLE is not a terminal-local variable, then set its normal
+binding, like `set'.  */)
+  (symbol, display, value)
+     Lisp_Object symbol;
+     Lisp_Object display;
+     Lisp_Object value;
+{
+  Lisp_Object result;
+  struct display *d = get_display (display, 1);
+  push_display_kboard (d);
+  result = Fset (symbol, value);
+  pop_frame_kboard ();
+  return result;
+}
 
 /* Find the function at the end of a chain of symbol function indirections.  */
 
@@ -3326,6 +3364,8 @@
   defsubr (&Slocal_variable_p);
   defsubr (&Slocal_variable_if_set_p);
   defsubr (&Svariable_binding_locus);
+  defsubr (&Sterminal_local_value);
+  defsubr (&Sset_terminal_local_value);
   defsubr (&Saref);
   defsubr (&Saset);
   defsubr (&Snumber_to_string);