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 49e1570c4c2..2f682450a16 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> |
| @@ -858,7 +859,18 @@ do_symval_forwarding (valcontents) | |||
| 858 | 859 | ||
| 859 | case Lisp_Misc_Kboard_Objfwd: | 860 | case Lisp_Misc_Kboard_Objfwd: |
| 860 | offset = XKBOARD_OBJFWD (valcontents)->offset; | 861 | offset = XKBOARD_OBJFWD (valcontents)->offset; |
| 861 | return *(Lisp_Object *)(offset + (char *)current_kboard); | 862 | /* We used to simply use current_kboard here, but from Lisp |
| 863 | code, it's value is often unexpected. It seems nicer to | ||
| 864 | allow constructions like this to work as intuitively expected: | ||
| 865 | |||
| 866 | (with-selected-frame frame | ||
| 867 | (define-key local-function-map "\eOP" [f1])) | ||
| 868 | |||
| 869 | On the other hand, this affects the semantics of | ||
| 870 | last-command and real-last-command, and people may rely on | ||
| 871 | that. I took a quick look at the Lisp codebase, and I | ||
| 872 | don't think anything will break. --lorentey */ | ||
| 873 | return *(Lisp_Object *)(offset + (char *)FRAME_KBOARD (SELECTED_FRAME ())); | ||
| 862 | } | 874 | } |
| 863 | return valcontents; | 875 | return valcontents; |
| 864 | } | 876 | } |
| @@ -946,7 +958,7 @@ store_symval_forwarding (symbol, valcontents, newval, buf) | |||
| 946 | 958 | ||
| 947 | case Lisp_Misc_Kboard_Objfwd: | 959 | case Lisp_Misc_Kboard_Objfwd: |
| 948 | { | 960 | { |
| 949 | char *base = (char *) current_kboard; | 961 | char *base = (char *) FRAME_KBOARD (SELECTED_FRAME ()); |
| 950 | char *p = base + XKBOARD_OBJFWD (valcontents)->offset; | 962 | char *p = base + XKBOARD_OBJFWD (valcontents)->offset; |
| 951 | *(Lisp_Object *) p = newval; | 963 | *(Lisp_Object *) p = newval; |
| 952 | } | 964 | } |
| @@ -1092,7 +1104,7 @@ find_symbol_value (symbol) | |||
| 1092 | 1104 | ||
| 1093 | case Lisp_Misc_Kboard_Objfwd: | 1105 | case Lisp_Misc_Kboard_Objfwd: |
| 1094 | return *(Lisp_Object *)(XKBOARD_OBJFWD (valcontents)->offset | 1106 | return *(Lisp_Object *)(XKBOARD_OBJFWD (valcontents)->offset |
| 1095 | + (char *)current_kboard); | 1107 | + (char *)FRAME_KBOARD (SELECTED_FRAME ())); |
| 1096 | } | 1108 | } |
| 1097 | } | 1109 | } |
| 1098 | 1110 | ||
| @@ -1853,6 +1865,51 @@ If the current binding is global (the default), the value is nil. */) | |||
| 1853 | 1865 | ||
| 1854 | return Qnil; | 1866 | return Qnil; |
| 1855 | } | 1867 | } |
| 1868 | |||
| 1869 | /* This code is disabled now that we use the selected frame to return | ||
| 1870 | keyboard-local-values. */ | ||
| 1871 | #if 0 | ||
| 1872 | extern struct terminal *get_terminal P_ ((Lisp_Object display, int)); | ||
| 1873 | |||
| 1874 | DEFUN ("terminal-local-value", Fterminal_local_value, Sterminal_local_value, 2, 2, 0, | ||
| 1875 | doc: /* Return the terminal-local value of SYMBOL on TERMINAL. | ||
| 1876 | If SYMBOL is not a terminal-local variable, then return its normal | ||
| 1877 | value, like `symbol-value'. | ||
| 1878 | |||
| 1879 | TERMINAL may be a terminal id, a frame, or nil (meaning the | ||
| 1880 | selected frame's terminal device). */) | ||
| 1881 | (symbol, terminal) | ||
| 1882 | Lisp_Object symbol; | ||
| 1883 | Lisp_Object terminal; | ||
| 1884 | { | ||
| 1885 | Lisp_Object result; | ||
| 1886 | struct terminal *t = get_terminal (terminal, 1); | ||
| 1887 | push_kboard (t->kboard); | ||
| 1888 | result = Fsymbol_value (symbol); | ||
| 1889 | pop_kboard (); | ||
| 1890 | return result; | ||
| 1891 | } | ||
| 1892 | |||
| 1893 | DEFUN ("set-terminal-local-value", Fset_terminal_local_value, Sset_terminal_local_value, 3, 3, 0, | ||
| 1894 | doc: /* Set the terminal-local binding of SYMBOL on TERMINAL to VALUE. | ||
| 1895 | If VARIABLE is not a terminal-local variable, then set its normal | ||
| 1896 | binding, like `set'. | ||
| 1897 | |||
| 1898 | TERMINAL may be a terminal id, a frame, or nil (meaning the | ||
| 1899 | selected frame's terminal device). */) | ||
| 1900 | (symbol, terminal, value) | ||
| 1901 | Lisp_Object symbol; | ||
| 1902 | Lisp_Object terminal; | ||
| 1903 | Lisp_Object value; | ||
| 1904 | { | ||
| 1905 | Lisp_Object result; | ||
| 1906 | struct terminal *t = get_terminal (terminal, 1); | ||
| 1907 | push_kboard (d->kboard); | ||
| 1908 | result = Fset (symbol, value); | ||
| 1909 | pop_kboard (); | ||
| 1910 | return result; | ||
| 1911 | } | ||
| 1912 | #endif | ||
| 1856 | 1913 | ||
| 1857 | /* Find the function at the end of a chain of symbol function indirections. */ | 1914 | /* Find the function at the end of a chain of symbol function indirections. */ |
| 1858 | 1915 | ||
| @@ -3310,6 +3367,10 @@ syms_of_data () | |||
| 3310 | defsubr (&Slocal_variable_p); | 3367 | defsubr (&Slocal_variable_p); |
| 3311 | defsubr (&Slocal_variable_if_set_p); | 3368 | defsubr (&Slocal_variable_if_set_p); |
| 3312 | defsubr (&Svariable_binding_locus); | 3369 | defsubr (&Svariable_binding_locus); |
| 3370 | #if 0 /* XXX Remove this. --lorentey */ | ||
| 3371 | defsubr (&Sterminal_local_value); | ||
| 3372 | defsubr (&Sset_terminal_local_value); | ||
| 3373 | #endif | ||
| 3313 | defsubr (&Saref); | 3374 | defsubr (&Saref); |
| 3314 | defsubr (&Saset); | 3375 | defsubr (&Saset); |
| 3315 | defsubr (&Snumber_to_string); | 3376 | defsubr (&Snumber_to_string); |