comparison src/data.c @ 91041:bdb3fe0ba9fa

Merge from emacs--devo--0 Patches applied: * emacs--devo--0 (patch 866-879) - Merge multi-tty branch - Update from CVS - Merge from emacs--rel--22 Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-257
author Miles Bader <miles@gnu.org>
date Thu, 11 Oct 2007 16:22:07 +0000
parents 57f4ffc03d13 48251c264d8d
children a0e466c4d599
comparison
equal deleted inserted replaced
91040:14c4a6aac623 91041:bdb3fe0ba9fa
28 #include "character.h" 28 #include "character.h"
29 #include "buffer.h" 29 #include "buffer.h"
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>
36 #endif 37 #endif
37 38
767 fun = Fsymbol_function (fun); 768 fun = Fsymbol_function (fun);
768 } 769 }
769 770
770 if (SUBRP (fun)) 771 if (SUBRP (fun))
771 { 772 {
772 if (XSUBR (fun)->prompt) 773 char *spec = XSUBR (fun)->intspec;
773 return list2 (Qinteractive, build_string (XSUBR (fun)->prompt)); 774 if (spec)
775 return list2 (Qinteractive,
776 (*spec != '(') ? build_string (spec) :
777 Fcar (Fread_from_string (build_string (spec), Qnil, Qnil)));
774 } 778 }
775 else if (COMPILEDP (fun)) 779 else if (COMPILEDP (fun))
776 { 780 {
777 if ((ASIZE (fun) & PSEUDOVECTOR_SIZE_MASK) > COMPILED_INTERACTIVE) 781 if ((ASIZE (fun) & PSEUDOVECTOR_SIZE_MASK) > COMPILED_INTERACTIVE)
778 return list2 (Qinteractive, AREF (fun, COMPILED_INTERACTIVE)); 782 return list2 (Qinteractive, AREF (fun, COMPILED_INTERACTIVE));
871 offset = XBUFFER_OBJFWD (valcontents)->offset; 875 offset = XBUFFER_OBJFWD (valcontents)->offset;
872 return PER_BUFFER_VALUE (current_buffer, offset); 876 return PER_BUFFER_VALUE (current_buffer, offset);
873 877
874 case Lisp_Misc_Kboard_Objfwd: 878 case Lisp_Misc_Kboard_Objfwd:
875 offset = XKBOARD_OBJFWD (valcontents)->offset; 879 offset = XKBOARD_OBJFWD (valcontents)->offset;
876 return *(Lisp_Object *)(offset + (char *)current_kboard); 880 /* We used to simply use current_kboard here, but from Lisp
881 code, it's value is often unexpected. It seems nicer to
882 allow constructions like this to work as intuitively expected:
883
884 (with-selected-frame frame
885 (define-key local-function-map "\eOP" [f1]))
886
887 On the other hand, this affects the semantics of
888 last-command and real-last-command, and people may rely on
889 that. I took a quick look at the Lisp codebase, and I
890 don't think anything will break. --lorentey */
891 return *(Lisp_Object *)(offset + (char *)FRAME_KBOARD (SELECTED_FRAME ()));
877 } 892 }
878 return valcontents; 893 return valcontents;
879 } 894 }
880 895
881 /* Store NEWVAL into SYMBOL, where VALCONTENTS is found in the value cell 896 /* Store NEWVAL into SYMBOL, where VALCONTENTS is found in the value cell
959 } 974 }
960 break; 975 break;
961 976
962 case Lisp_Misc_Kboard_Objfwd: 977 case Lisp_Misc_Kboard_Objfwd:
963 { 978 {
964 char *base = (char *) current_kboard; 979 char *base = (char *) FRAME_KBOARD (SELECTED_FRAME ());
965 char *p = base + XKBOARD_OBJFWD (valcontents)->offset; 980 char *p = base + XKBOARD_OBJFWD (valcontents)->offset;
966 *(Lisp_Object *) p = newval; 981 *(Lisp_Object *) p = newval;
967 } 982 }
968 break; 983 break;
969 984
1105 return PER_BUFFER_VALUE (current_buffer, 1120 return PER_BUFFER_VALUE (current_buffer,
1106 XBUFFER_OBJFWD (valcontents)->offset); 1121 XBUFFER_OBJFWD (valcontents)->offset);
1107 1122
1108 case Lisp_Misc_Kboard_Objfwd: 1123 case Lisp_Misc_Kboard_Objfwd:
1109 return *(Lisp_Object *)(XKBOARD_OBJFWD (valcontents)->offset 1124 return *(Lisp_Object *)(XKBOARD_OBJFWD (valcontents)->offset
1110 + (char *)current_kboard); 1125 + (char *)FRAME_KBOARD (SELECTED_FRAME ()));
1111 } 1126 }
1112 } 1127 }
1113 1128
1114 return valcontents; 1129 return valcontents;
1115 } 1130 }
1866 return XBUFFER_LOCAL_VALUE (valcontents)->frame; 1881 return XBUFFER_LOCAL_VALUE (valcontents)->frame;
1867 } 1882 }
1868 1883
1869 return Qnil; 1884 return Qnil;
1870 } 1885 }
1886
1887 /* This code is disabled now that we use the selected frame to return
1888 keyboard-local-values. */
1889 #if 0
1890 extern struct terminal *get_terminal P_ ((Lisp_Object display, int));
1891
1892 DEFUN ("terminal-local-value", Fterminal_local_value, Sterminal_local_value, 2, 2, 0,
1893 doc: /* Return the terminal-local value of SYMBOL on TERMINAL.
1894 If SYMBOL is not a terminal-local variable, then return its normal
1895 value, like `symbol-value'.
1896
1897 TERMINAL may be a terminal id, a frame, or nil (meaning the
1898 selected frame's terminal device). */)
1899 (symbol, terminal)
1900 Lisp_Object symbol;
1901 Lisp_Object terminal;
1902 {
1903 Lisp_Object result;
1904 struct terminal *t = get_terminal (terminal, 1);
1905 push_kboard (t->kboard);
1906 result = Fsymbol_value (symbol);
1907 pop_kboard ();
1908 return result;
1909 }
1910
1911 DEFUN ("set-terminal-local-value", Fset_terminal_local_value, Sset_terminal_local_value, 3, 3, 0,
1912 doc: /* Set the terminal-local binding of SYMBOL on TERMINAL to VALUE.
1913 If VARIABLE is not a terminal-local variable, then set its normal
1914 binding, like `set'.
1915
1916 TERMINAL may be a terminal id, a frame, or nil (meaning the
1917 selected frame's terminal device). */)
1918 (symbol, terminal, value)
1919 Lisp_Object symbol;
1920 Lisp_Object terminal;
1921 Lisp_Object value;
1922 {
1923 Lisp_Object result;
1924 struct terminal *t = get_terminal (terminal, 1);
1925 push_kboard (d->kboard);
1926 result = Fset (symbol, value);
1927 pop_kboard ();
1928 return result;
1929 }
1930 #endif
1871 1931
1872 /* Find the function at the end of a chain of symbol function indirections. */ 1932 /* Find the function at the end of a chain of symbol function indirections. */
1873 1933
1874 /* If OBJECT is a symbol, find the end of its function chain and 1934 /* If OBJECT is a symbol, find the end of its function chain and
1875 return the value found there. If OBJECT is not a symbol, just 1935 return the value found there. If OBJECT is not a symbol, just
3171 defsubr (&Skill_local_variable); 3231 defsubr (&Skill_local_variable);
3172 defsubr (&Smake_variable_frame_local); 3232 defsubr (&Smake_variable_frame_local);
3173 defsubr (&Slocal_variable_p); 3233 defsubr (&Slocal_variable_p);
3174 defsubr (&Slocal_variable_if_set_p); 3234 defsubr (&Slocal_variable_if_set_p);
3175 defsubr (&Svariable_binding_locus); 3235 defsubr (&Svariable_binding_locus);
3236 #if 0 /* XXX Remove this. --lorentey */
3237 defsubr (&Sterminal_local_value);
3238 defsubr (&Sset_terminal_local_value);
3239 #endif
3176 defsubr (&Saref); 3240 defsubr (&Saref);
3177 defsubr (&Saset); 3241 defsubr (&Saset);
3178 defsubr (&Snumber_to_string); 3242 defsubr (&Snumber_to_string);
3179 defsubr (&Sstring_to_number); 3243 defsubr (&Sstring_to_number);
3180 defsubr (&Seqlsign); 3244 defsubr (&Seqlsign);