diff options
author | Andrea Corallo <akrl@sdf.org> | 2020-05-08 20:23:38 +0100 |
---|---|---|
committer | Andrea Corallo <akrl@sdf.org> | 2020-05-08 20:33:00 +0100 |
commit | e2f183cf1742b30d4cbd25aa54f7485006b63bfe (patch) | |
tree | 7fdd938c5a1b2bb9f4abb77372c1b2f2915fad17 | |
parent | 0b0098a697c2ab5069877758fcdaf57d5e438cb1 (diff) | |
download | emacs-e2f183cf1742b30d4cbd25aa54f7485006b63bfe.tar.gz |
Shallow setters by default are not a good ideascratch/lexspaces
-rw-r--r-- | src/lisp.h | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/lisp.h b/src/lisp.h index 93e7094b420..682de4981f9 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -2294,9 +2294,12 @@ SET_SYMBOL_VAL (struct Lisp_Symbol *sym, Lisp_Object v) eassert (sym->u.s.redirect == SYMBOL_PLAINVAL); if (EQ (sym->u.s.val.value, Qunbound)) sym->u.s.val.value = make_binding (Qunbound); + EMACS_INT lexspace = CURRENT_LEXSPACE; struct Lisp_Binding *binding = XBINDING (sym->u.s.val.value); - binding->r[CURRENT_LEXSPACE] = false; - binding->b[CURRENT_LEXSPACE] = v; + while (binding->r[lexspace]) + lexspace = XFIXNUM (binding->b[lexspace]); + binding->r[lexspace] = false; + binding->b[lexspace] = v; } INLINE void @@ -3482,7 +3485,12 @@ set_symbol_function (Lisp_Object sym, Lisp_Object function) /* Functions must execute in the original lexspace so lets store it. */ if (CONSP (function) && EQ (XCAR (function), Qclosure)) function = Fcons (Vcurrent_lexspace_idx, function); - XBINDING (s->u.s._function)->b[CURRENT_LEXSPACE] = function; + EMACS_INT lexspace = CURRENT_LEXSPACE; + struct Lisp_Binding *binding = XBINDING (s->u.s._function); + /* Follow redirections. */ + while (binding->r[lexspace]) + lexspace = XFIXNUM (binding->b[lexspace]); + binding->b[lexspace] = function; } INLINE void |