diff options
Diffstat (limited to 'src/data.c')
| -rw-r--r-- | src/data.c | 67 |
1 files changed, 64 insertions, 3 deletions
diff --git a/src/data.c b/src/data.c index 3f27e387350..1f82f929281 100644 --- a/src/data.c +++ b/src/data.c | |||
| @@ -30,6 +30,7 @@ Boston, MA 02110-1301, USA. */ | |||
| 30 | #include "keyboard.h" | 30 | #include "keyboard.h" |
| 31 | #include "frame.h" | 31 | #include "frame.h" |
| 32 | #include "syssignal.h" | 32 | #include "syssignal.h" |
| 33 | #include "termhooks.h" /* For FRAME_KBOARD reference in y-or-n-p. */ | ||
| 33 | 34 | ||
| 34 | #ifdef STDC_HEADERS | 35 | #ifdef STDC_HEADERS |
| 35 | #include <float.h> | 36 | #include <float.h> |
| @@ -873,7 +874,18 @@ do_symval_forwarding (valcontents) | |||
| 873 | 874 | ||
| 874 | case Lisp_Misc_Kboard_Objfwd: | 875 | case Lisp_Misc_Kboard_Objfwd: |
| 875 | offset = XKBOARD_OBJFWD (valcontents)->offset; | 876 | offset = XKBOARD_OBJFWD (valcontents)->offset; |
| 876 | return *(Lisp_Object *)(offset + (char *)current_kboard); | 877 | /* We used to simply use current_kboard here, but from Lisp |
| 878 | code, it's value is often unexpected. It seems nicer to | ||
| 879 | allow constructions like this to work as intuitively expected: | ||
| 880 | |||
| 881 | (with-selected-frame frame | ||
| 882 | (define-key local-function-map "\eOP" [f1])) | ||
| 883 | |||
| 884 | On the other hand, this affects the semantics of | ||
| 885 | last-command and real-last-command, and people may rely on | ||
| 886 | that. I took a quick look at the Lisp codebase, and I | ||
| 887 | don't think anything will break. --lorentey */ | ||
| 888 | return *(Lisp_Object *)(offset + (char *)FRAME_KBOARD (SELECTED_FRAME ())); | ||
| 877 | } | 889 | } |
| 878 | return valcontents; | 890 | return valcontents; |
| 879 | } | 891 | } |
| @@ -961,7 +973,7 @@ store_symval_forwarding (symbol, valcontents, newval, buf) | |||
| 961 | 973 | ||
| 962 | case Lisp_Misc_Kboard_Objfwd: | 974 | case Lisp_Misc_Kboard_Objfwd: |
| 963 | { | 975 | { |
| 964 | char *base = (char *) current_kboard; | 976 | char *base = (char *) FRAME_KBOARD (SELECTED_FRAME ()); |
| 965 | char *p = base + XKBOARD_OBJFWD (valcontents)->offset; | 977 | char *p = base + XKBOARD_OBJFWD (valcontents)->offset; |
| 966 | *(Lisp_Object *) p = newval; | 978 | *(Lisp_Object *) p = newval; |
| 967 | } | 979 | } |
| @@ -1107,7 +1119,7 @@ find_symbol_value (symbol) | |||
| 1107 | 1119 | ||
| 1108 | case Lisp_Misc_Kboard_Objfwd: | 1120 | case Lisp_Misc_Kboard_Objfwd: |
| 1109 | return *(Lisp_Object *)(XKBOARD_OBJFWD (valcontents)->offset | 1121 | return *(Lisp_Object *)(XKBOARD_OBJFWD (valcontents)->offset |
| 1110 | + (char *)current_kboard); | 1122 | + (char *)FRAME_KBOARD (SELECTED_FRAME ())); |
| 1111 | } | 1123 | } |
| 1112 | } | 1124 | } |
| 1113 | 1125 | ||
| @@ -1868,6 +1880,51 @@ If the current binding is global (the default), the value is nil. */) | |||
| 1868 | 1880 | ||
| 1869 | return Qnil; | 1881 | return Qnil; |
| 1870 | } | 1882 | } |
| 1883 | |||
| 1884 | /* This code is disabled now that we use the selected frame to return | ||
| 1885 | keyboard-local-values. */ | ||
| 1886 | #if 0 | ||
| 1887 | extern struct terminal *get_terminal P_ ((Lisp_Object display, int)); | ||
| 1888 | |||
| 1889 | DEFUN ("terminal-local-value", Fterminal_local_value, Sterminal_local_value, 2, 2, 0, | ||
| 1890 | doc: /* Return the terminal-local value of SYMBOL on TERMINAL. | ||
| 1891 | If SYMBOL is not a terminal-local variable, then return its normal | ||
| 1892 | value, like `symbol-value'. | ||
| 1893 | |||
| 1894 | TERMINAL may be a terminal id, a frame, or nil (meaning the | ||
| 1895 | selected frame's terminal device). */) | ||
| 1896 | (symbol, terminal) | ||
| 1897 | Lisp_Object symbol; | ||
| 1898 | Lisp_Object terminal; | ||
| 1899 | { | ||
| 1900 | Lisp_Object result; | ||
| 1901 | struct terminal *t = get_terminal (terminal, 1); | ||
| 1902 | push_kboard (t->kboard); | ||
| 1903 | result = Fsymbol_value (symbol); | ||
| 1904 | pop_kboard (); | ||
| 1905 | return result; | ||
| 1906 | } | ||
| 1907 | |||
| 1908 | DEFUN ("set-terminal-local-value", Fset_terminal_local_value, Sset_terminal_local_value, 3, 3, 0, | ||
| 1909 | doc: /* Set the terminal-local binding of SYMBOL on TERMINAL to VALUE. | ||
| 1910 | If VARIABLE is not a terminal-local variable, then set its normal | ||
| 1911 | binding, like `set'. | ||
| 1912 | |||
| 1913 | TERMINAL may be a terminal id, a frame, or nil (meaning the | ||
| 1914 | selected frame's terminal device). */) | ||
| 1915 | (symbol, terminal, value) | ||
| 1916 | Lisp_Object symbol; | ||
| 1917 | Lisp_Object terminal; | ||
| 1918 | Lisp_Object value; | ||
| 1919 | { | ||
| 1920 | Lisp_Object result; | ||
| 1921 | struct terminal *t = get_terminal (terminal, 1); | ||
| 1922 | push_kboard (d->kboard); | ||
| 1923 | result = Fset (symbol, value); | ||
| 1924 | pop_kboard (); | ||
| 1925 | return result; | ||
| 1926 | } | ||
| 1927 | #endif | ||
| 1871 | 1928 | ||
| 1872 | /* Find the function at the end of a chain of symbol function indirections. */ | 1929 | /* Find the function at the end of a chain of symbol function indirections. */ |
| 1873 | 1930 | ||
| @@ -3327,6 +3384,10 @@ syms_of_data () | |||
| 3327 | defsubr (&Slocal_variable_p); | 3384 | defsubr (&Slocal_variable_p); |
| 3328 | defsubr (&Slocal_variable_if_set_p); | 3385 | defsubr (&Slocal_variable_if_set_p); |
| 3329 | defsubr (&Svariable_binding_locus); | 3386 | defsubr (&Svariable_binding_locus); |
| 3387 | #if 0 /* XXX Remove this. --lorentey */ | ||
| 3388 | defsubr (&Sterminal_local_value); | ||
| 3389 | defsubr (&Sset_terminal_local_value); | ||
| 3390 | #endif | ||
| 3330 | defsubr (&Saref); | 3391 | defsubr (&Saref); |
| 3331 | defsubr (&Saset); | 3392 | defsubr (&Saset); |
| 3332 | defsubr (&Snumber_to_string); | 3393 | defsubr (&Snumber_to_string); |