diff options
| author | Wilson Snyder <wsnyder@wsnyder.org> | 2019-05-06 18:35:59 -0400 |
|---|---|---|
| committer | Wilson Snyder <wsnyder@wsnyder.org> | 2019-05-06 18:35:59 -0400 |
| commit | 921d279e15256a07168033b0c50f1fc82e22ef7f (patch) | |
| tree | e048888bb4983009668a594f6ba83e3baa1b6ea3 /src | |
| parent | 01963fbbe10d290ba037cd523d21ebbcd2536b40 (diff) | |
| parent | 6fa99f06b92b593082d7181ba59ab7eebda45f81 (diff) | |
| download | emacs-921d279e15256a07168033b0c50f1fc82e22ef7f.tar.gz | |
Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs
Diffstat (limited to 'src')
| -rw-r--r-- | src/eval.c | 50 | ||||
| -rw-r--r-- | src/insdel.c | 13 |
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, return Qnil; } +DEFUN ("internal--define-uninitialized-variable", + Finternal__define_uninitialized_variable, + Sinternal__define_uninitialized_variable, 1, 2, 0, + doc: /* Define SYMBOL as a variable, with DOC as its docstring. +This is like `defvar' and `defconst' but without affecting the variable's +value. */) + (Lisp_Object symbol, Lisp_Object doc) +{ + XSYMBOL (symbol)->u.s.declared_special = true; + if (!NILP (doc)) + { + if (!NILP (Vpurify_flag)) + doc = Fpurecopy (doc); + Fput (symbol, Qvariable_documentation, doc); + } + LOADHIST_ATTACH (symbol); + return Qnil; +} + DEFUN ("defvar", Fdefvar, Sdefvar, 1, UNEVALLED, 0, doc: /* Define SYMBOL as a variable, and return SYMBOL. You are not required to define a variable in order to use it, but @@ -754,32 +773,25 @@ usage: (defvar SYMBOL &optional INITVALUE DOCSTRING) */) { if (!NILP (XCDR (tail)) && !NILP (XCDR (XCDR (tail)))) error ("Too many arguments"); + Lisp_Object exp = XCAR (tail); tem = Fdefault_boundp (sym); + tail = XCDR (tail); /* Do it before evaluating the initial value, for self-references. */ - XSYMBOL (sym)->u.s.declared_special = true; + Finternal__define_uninitialized_variable (sym, CAR (tail)); if (NILP (tem)) - Fset_default (sym, eval_sub (XCAR (tail))); + Fset_default (sym, eval_sub (exp)); else { /* Check if there is really a global binding rather than just a let binding that shadows the global unboundness of the var. */ union specbinding *binding = default_toplevel_binding (sym); if (binding && EQ (specpdl_old_value (binding), Qunbound)) { - set_specpdl_old_value (binding, eval_sub (XCAR (tail))); + set_specpdl_old_value (binding, eval_sub (exp)); } } - tail = XCDR (tail); - tem = Fcar (tail); - if (!NILP (tem)) - { - if (!NILP (Vpurify_flag)) - tem = Fpurecopy (tem); - Fput (sym, Qvariable_documentation, tem); - } - LOADHIST_ATTACH (sym); } else if (!NILP (Vinternal_interpreter_environment) && (SYMBOLP (sym) && !XSYMBOL (sym)->u.s.declared_special)) @@ -827,19 +839,12 @@ usage: (defconst SYMBOL INITVALUE [DOCSTRING]) */) docstring = XCAR (XCDR (XCDR (args))); } + Finternal__define_uninitialized_variable (sym, docstring); tem = eval_sub (XCAR (XCDR (args))); if (!NILP (Vpurify_flag)) tem = Fpurecopy (tem); - Fset_default (sym, tem); - XSYMBOL (sym)->u.s.declared_special = true; - if (!NILP (docstring)) - { - if (!NILP (Vpurify_flag)) - docstring = Fpurecopy (docstring); - Fput (sym, Qvariable_documentation, docstring); - } - Fput (sym, Qrisky_local_variable, Qt); - LOADHIST_ATTACH (sym); + Fset_default (sym, tem); /* FIXME: set-default-toplevel-value? */ + Fput (sym, Qrisky_local_variable, Qt); /* FIXME: Why? */ return sym; } @@ -4198,6 +4203,7 @@ alist of active lexical bindings. */); defsubr (&Sdefvaralias); DEFSYM (Qdefvaralias, "defvaralias"); defsubr (&Sdefconst); + defsubr (&Sinternal__define_uninitialized_variable); defsubr (&Smake_var_non_special); defsubr (&Slet); 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) { ptrdiff_t count = SPECPDL_INDEX (); struct rvoe_arg rvoe_arg; + Lisp_Object tmp; if (inhibit_modification_hooks) return; @@ -2186,7 +2187,16 @@ signal_after_change (ptrdiff_t charpos, ptrdiff_t lendel, ptrdiff_t lenins) and there are no before-change functions, just record the args that we were going to use. */ if (! NILP (Vcombine_after_change_calls) - && NILP (Vbefore_change_functions) + /* It's OK to defer after-changes even if syntax-ppss-flush-cache + * is on before-change-functions, which is common enough to be worth + * adding a special case for it. */ + && (NILP (Vbefore_change_functions) + || (CONSP (Vbefore_change_functions) + && EQ (Qt, XCAR (Vbefore_change_functions)) + && NILP (Fdefault_value (Qbefore_change_functions)) + && CONSP (tmp = XCDR (Vbefore_change_functions)) + && NILP (XCDR (tmp)) + && EQ (XCAR (tmp), Qsyntax_ppss_flush_cache))) && !buffer_has_overlays ()) { Lisp_Object elt; @@ -2343,6 +2353,7 @@ syms_of_insdel (void) combine_after_change_buffer = Qnil; DEFSYM (Qundo_auto__undoable_change, "undo-auto--undoable-change"); + DEFSYM (Qsyntax_ppss_flush_cache, "syntax-ppss-flush-cache"); DEFVAR_LISP ("combine-after-change-calls", Vcombine_after_change_calls, doc: /* Used internally by the function `combine-after-change-calls' macro. */); |
