diff options
| author | Karl Heuer | 1998-04-08 18:56:20 +0000 |
|---|---|---|
| committer | Karl Heuer | 1998-04-08 18:56:20 +0000 |
| commit | 5c5aad07106282d3534823d9212f800918bc5df8 (patch) | |
| tree | fba01f735a6a6e8fd83589f135b50234947015e9 /src/data.c | |
| parent | 0dfb1b759ef5fcd0d14987dc9e9d6ac60c1f1de3 (diff) | |
| download | emacs-5c5aad07106282d3534823d9212f800918bc5df8.tar.gz emacs-5c5aad07106282d3534823d9212f800918bc5df8.zip | |
(keyword_symbols_constant_flag): New variable.
(syms_of_data): Set up Lisp variable.
(set_internal): Obey it and give error for :-symbols.
(Fmakunbound): Likewise.
Diffstat (limited to 'src/data.c')
| -rw-r--r-- | src/data.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/data.c b/src/data.c index c9eaee7a9b2..5b3a33bddfa 100644 --- a/src/data.c +++ b/src/data.c | |||
| @@ -68,6 +68,10 @@ Boston, MA 02111-1307, USA. */ | |||
| 68 | extern double atof (); | 68 | extern double atof (); |
| 69 | #endif /* !atof */ | 69 | #endif /* !atof */ |
| 70 | 70 | ||
| 71 | /* Nonzero means it is an error to set a symbol whose name starts with | ||
| 72 | colon. */ | ||
| 73 | int keyword_symbols_constant_flag; | ||
| 74 | |||
| 71 | Lisp_Object Qnil, Qt, Qquote, Qlambda, Qsubr, Qunbound; | 75 | Lisp_Object Qnil, Qt, Qquote, Qlambda, Qsubr, Qunbound; |
| 72 | Lisp_Object Qerror_conditions, Qerror_message, Qtop_level; | 76 | Lisp_Object Qerror_conditions, Qerror_message, Qtop_level; |
| 73 | Lisp_Object Qerror, Qquit, Qwrong_type_argument, Qargs_out_of_range; | 77 | Lisp_Object Qerror, Qquit, Qwrong_type_argument, Qargs_out_of_range; |
| @@ -611,7 +615,9 @@ DEFUN ("makunbound", Fmakunbound, Smakunbound, 1, 1, 0, "Make SYMBOL's value be | |||
| 611 | register Lisp_Object symbol; | 615 | register Lisp_Object symbol; |
| 612 | { | 616 | { |
| 613 | CHECK_SYMBOL (symbol, 0); | 617 | CHECK_SYMBOL (symbol, 0); |
| 614 | if (NILP (symbol) || EQ (symbol, Qt)) | 618 | if (NILP (symbol) || EQ (symbol, Qt) |
| 619 | || (XSYMBOL (symbol)->name->data[0] == ':' | ||
| 620 | && keyword_symbols_constant_flag)) | ||
| 615 | return Fsignal (Qsetting_constant, Fcons (symbol, Qnil)); | 621 | return Fsignal (Qsetting_constant, Fcons (symbol, Qnil)); |
| 616 | Fset (symbol, Qunbound); | 622 | Fset (symbol, Qunbound); |
| 617 | return symbol; | 623 | return symbol; |
| @@ -960,7 +966,9 @@ set_internal (symbol, newval, bindflag) | |||
| 960 | register Lisp_Object valcontents, tem1, current_alist_element; | 966 | register Lisp_Object valcontents, tem1, current_alist_element; |
| 961 | 967 | ||
| 962 | CHECK_SYMBOL (symbol, 0); | 968 | CHECK_SYMBOL (symbol, 0); |
| 963 | if (NILP (symbol) || EQ (symbol, Qt)) | 969 | if (NILP (symbol) || EQ (symbol, Qt) |
| 970 | || (XSYMBOL (symbol)->name->data[0] == ':' | ||
| 971 | && keyword_symbols_constant_flag)) | ||
| 964 | return Fsignal (Qsetting_constant, Fcons (symbol, Qnil)); | 972 | return Fsignal (Qsetting_constant, Fcons (symbol, Qnil)); |
| 965 | valcontents = XSYMBOL (symbol)->value; | 973 | valcontents = XSYMBOL (symbol)->value; |
| 966 | 974 | ||
| @@ -2833,6 +2841,11 @@ syms_of_data () | |||
| 2833 | staticpro (&Qchar_table); | 2841 | staticpro (&Qchar_table); |
| 2834 | staticpro (&Qbool_vector); | 2842 | staticpro (&Qbool_vector); |
| 2835 | 2843 | ||
| 2844 | DEFVAR_BOOL ("keyword-symbols-constant-flag", &keyword_symbols_constant_flag, | ||
| 2845 | "Non-nil means it is an error to set a keyword symbol.\n\ | ||
| 2846 | A keyword symbol is a symbol whose name starts with a colon (`:')."); | ||
| 2847 | keyword_symbols_constant_flag = 1; | ||
| 2848 | |||
| 2836 | defsubr (&Seq); | 2849 | defsubr (&Seq); |
| 2837 | defsubr (&Snull); | 2850 | defsubr (&Snull); |
| 2838 | defsubr (&Stype_of); | 2851 | defsubr (&Stype_of); |