aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorWilson Snyder2019-05-06 18:35:59 -0400
committerWilson Snyder2019-05-06 18:35:59 -0400
commit921d279e15256a07168033b0c50f1fc82e22ef7f (patch)
treee048888bb4983009668a594f6ba83e3baa1b6ea3 /src
parent01963fbbe10d290ba037cd523d21ebbcd2536b40 (diff)
parent6fa99f06b92b593082d7181ba59ab7eebda45f81 (diff)
downloademacs-921d279e15256a07168033b0c50f1fc82e22ef7f.tar.gz
emacs-921d279e15256a07168033b0c50f1fc82e22ef7f.zip
Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs
Diffstat (limited to 'src')
-rw-r--r--src/eval.c50
-rw-r--r--src/insdel.c13
2 files changed, 40 insertions, 23 deletions
diff --git a/src/eval.c b/src/eval.c
index 3fd9a40a3a2..567c32e0d75 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -715,6 +715,25 @@ DEFUN ("set-default-toplevel-value", Fset_default_toplevel_value,
715 return Qnil; 715 return Qnil;
716} 716}
717 717
718DEFUN ("internal--define-uninitialized-variable",
719 Finternal__define_uninitialized_variable,
720 Sinternal__define_uninitialized_variable, 1, 2, 0,
721 doc: /* Define SYMBOL as a variable, with DOC as its docstring.
722This is like `defvar' and `defconst' but without affecting the variable's
723value. */)
724 (Lisp_Object symbol, Lisp_Object doc)
725{
726 XSYMBOL (symbol)->u.s.declared_special = true;
727 if (!NILP (doc))
728 {
729 if (!NILP (Vpurify_flag))
730 doc = Fpurecopy (doc);
731 Fput (symbol, Qvariable_documentation, doc);
732 }
733 LOADHIST_ATTACH (symbol);
734 return Qnil;
735}
736
718DEFUN ("defvar", Fdefvar, Sdefvar, 1, UNEVALLED, 0, 737DEFUN ("defvar", Fdefvar, Sdefvar, 1, UNEVALLED, 0,
719 doc: /* Define SYMBOL as a variable, and return SYMBOL. 738 doc: /* Define SYMBOL as a variable, and return SYMBOL.
720You are not required to define a variable in order to use it, but 739You are not required to define a variable in order to use it, but
@@ -754,32 +773,25 @@ usage: (defvar SYMBOL &optional INITVALUE DOCSTRING) */)
754 { 773 {
755 if (!NILP (XCDR (tail)) && !NILP (XCDR (XCDR (tail)))) 774 if (!NILP (XCDR (tail)) && !NILP (XCDR (XCDR (tail))))
756 error ("Too many arguments"); 775 error ("Too many arguments");
776 Lisp_Object exp = XCAR (tail);
757 777
758 tem = Fdefault_boundp (sym); 778 tem = Fdefault_boundp (sym);
779 tail = XCDR (tail);
759 780
760 /* Do it before evaluating the initial value, for self-references. */ 781 /* Do it before evaluating the initial value, for self-references. */
761 XSYMBOL (sym)->u.s.declared_special = true; 782 Finternal__define_uninitialized_variable (sym, CAR (tail));
762 783
763 if (NILP (tem)) 784 if (NILP (tem))
764 Fset_default (sym, eval_sub (XCAR (tail))); 785 Fset_default (sym, eval_sub (exp));
765 else 786 else
766 { /* Check if there is really a global binding rather than just a let 787 { /* Check if there is really a global binding rather than just a let
767 binding that shadows the global unboundness of the var. */ 788 binding that shadows the global unboundness of the var. */
768 union specbinding *binding = default_toplevel_binding (sym); 789 union specbinding *binding = default_toplevel_binding (sym);
769 if (binding && EQ (specpdl_old_value (binding), Qunbound)) 790 if (binding && EQ (specpdl_old_value (binding), Qunbound))
770 { 791 {
771 set_specpdl_old_value (binding, eval_sub (XCAR (tail))); 792 set_specpdl_old_value (binding, eval_sub (exp));
772 } 793 }
773 } 794 }
774 tail = XCDR (tail);
775 tem = Fcar (tail);
776 if (!NILP (tem))
777 {
778 if (!NILP (Vpurify_flag))
779 tem = Fpurecopy (tem);
780 Fput (sym, Qvariable_documentation, tem);
781 }
782 LOADHIST_ATTACH (sym);
783 } 795 }
784 else if (!NILP (Vinternal_interpreter_environment) 796 else if (!NILP (Vinternal_interpreter_environment)
785 && (SYMBOLP (sym) && !XSYMBOL (sym)->u.s.declared_special)) 797 && (SYMBOLP (sym) && !XSYMBOL (sym)->u.s.declared_special))
@@ -827,19 +839,12 @@ usage: (defconst SYMBOL INITVALUE [DOCSTRING]) */)
827 docstring = XCAR (XCDR (XCDR (args))); 839 docstring = XCAR (XCDR (XCDR (args)));
828 } 840 }
829 841
842 Finternal__define_uninitialized_variable (sym, docstring);
830 tem = eval_sub (XCAR (XCDR (args))); 843 tem = eval_sub (XCAR (XCDR (args)));
831 if (!NILP (Vpurify_flag)) 844 if (!NILP (Vpurify_flag))
832 tem = Fpurecopy (tem); 845 tem = Fpurecopy (tem);
833 Fset_default (sym, tem); 846 Fset_default (sym, tem); /* FIXME: set-default-toplevel-value? */
834 XSYMBOL (sym)->u.s.declared_special = true; 847 Fput (sym, Qrisky_local_variable, Qt); /* FIXME: Why? */
835 if (!NILP (docstring))
836 {
837 if (!NILP (Vpurify_flag))
838 docstring = Fpurecopy (docstring);
839 Fput (sym, Qvariable_documentation, docstring);
840 }
841 Fput (sym, Qrisky_local_variable, Qt);
842 LOADHIST_ATTACH (sym);
843 return sym; 848 return sym;
844} 849}
845 850
@@ -4198,6 +4203,7 @@ alist of active lexical bindings. */);
4198 defsubr (&Sdefvaralias); 4203 defsubr (&Sdefvaralias);
4199 DEFSYM (Qdefvaralias, "defvaralias"); 4204 DEFSYM (Qdefvaralias, "defvaralias");
4200 defsubr (&Sdefconst); 4205 defsubr (&Sdefconst);
4206 defsubr (&Sinternal__define_uninitialized_variable);
4201 defsubr (&Smake_var_non_special); 4207 defsubr (&Smake_var_non_special);
4202 defsubr (&Slet); 4208 defsubr (&Slet);
4203 defsubr (&SletX); 4209 defsubr (&SletX);
diff --git a/src/insdel.c b/src/insdel.c
index 1231bb2682b..85fffd8fd16 100644
--- a/src/insdel.c
+++ b/src/insdel.c
@@ -2178,6 +2178,7 @@ signal_after_change (ptrdiff_t charpos, ptrdiff_t lendel, ptrdiff_t lenins)
2178{ 2178{
2179 ptrdiff_t count = SPECPDL_INDEX (); 2179 ptrdiff_t count = SPECPDL_INDEX ();
2180 struct rvoe_arg rvoe_arg; 2180 struct rvoe_arg rvoe_arg;
2181 Lisp_Object tmp;
2181 2182
2182 if (inhibit_modification_hooks) 2183 if (inhibit_modification_hooks)
2183 return; 2184 return;
@@ -2186,7 +2187,16 @@ signal_after_change (ptrdiff_t charpos, ptrdiff_t lendel, ptrdiff_t lenins)
2186 and there are no before-change functions, 2187 and there are no before-change functions,
2187 just record the args that we were going to use. */ 2188 just record the args that we were going to use. */
2188 if (! NILP (Vcombine_after_change_calls) 2189 if (! NILP (Vcombine_after_change_calls)
2189 && NILP (Vbefore_change_functions) 2190 /* It's OK to defer after-changes even if syntax-ppss-flush-cache
2191 * is on before-change-functions, which is common enough to be worth
2192 * adding a special case for it. */
2193 && (NILP (Vbefore_change_functions)
2194 || (CONSP (Vbefore_change_functions)
2195 && EQ (Qt, XCAR (Vbefore_change_functions))
2196 && NILP (Fdefault_value (Qbefore_change_functions))
2197 && CONSP (tmp = XCDR (Vbefore_change_functions))
2198 && NILP (XCDR (tmp))
2199 && EQ (XCAR (tmp), Qsyntax_ppss_flush_cache)))
2190 && !buffer_has_overlays ()) 2200 && !buffer_has_overlays ())
2191 { 2201 {
2192 Lisp_Object elt; 2202 Lisp_Object elt;
@@ -2343,6 +2353,7 @@ syms_of_insdel (void)
2343 combine_after_change_buffer = Qnil; 2353 combine_after_change_buffer = Qnil;
2344 2354
2345 DEFSYM (Qundo_auto__undoable_change, "undo-auto--undoable-change"); 2355 DEFSYM (Qundo_auto__undoable_change, "undo-auto--undoable-change");
2356 DEFSYM (Qsyntax_ppss_flush_cache, "syntax-ppss-flush-cache");
2346 2357
2347 DEFVAR_LISP ("combine-after-change-calls", Vcombine_after_change_calls, 2358 DEFVAR_LISP ("combine-after-change-calls", Vcombine_after_change_calls,
2348 doc: /* Used internally by the function `combine-after-change-calls' macro. */); 2359 doc: /* Used internally by the function `combine-after-change-calls' macro. */);