summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2023-04-02 17:45:58 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2023-04-02 17:45:58 -0400
commit5223762e02ac84eee984cd1f7a17865766cdad9a (patch)
tree379f3431cbf74fc73afc5fe89314bc98d1db762b /src
parent00144fa287eb168c1ba8e411e43fe13b9d2732ac (diff)
downloademacs-5223762e02ac84eee984cd1f7a17865766cdad9a.tar.gz
src/eval.c: Fix bug#62419
Yup, almost 40 years after ELisp first combined them, buffer-local and let bindings still don't work quite right :-( The "automatically buffer-local if set" semantics should follow the principle that it becomes buffer-local iff the var's current binding refers to the top-level/global/non-let binding. * src/eval.c (let_shadows_buffer_binding_p): Disregard non-global let-bindings. * test/src/eval-tests.el (eval-test--bug62419): New test.
Diffstat (limited to 'src')
-rw-r--r--src/eval.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/eval.c b/src/eval.c
index eb40c953f96..1a4d3ad0307 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -3400,7 +3400,7 @@ DEFUN ("fetch-bytecode", Ffetch_bytecode, Sfetch_bytecode,
return object;
}
-/* Return true if SYMBOL currently has a let-binding
+/* Return true if SYMBOL's default currently has a let-binding
which was made in the buffer that is now current. */
bool
@@ -3415,6 +3415,7 @@ let_shadows_buffer_binding_p (struct Lisp_Symbol *symbol)
struct Lisp_Symbol *let_bound_symbol = XSYMBOL (specpdl_symbol (p));
eassert (let_bound_symbol->u.s.redirect != SYMBOL_VARALIAS);
if (symbol == let_bound_symbol
+ && p->kind != SPECPDL_LET_LOCAL /* bug#62419 */
&& EQ (specpdl_where (p), buf))
return 1;
}