aboutsummaryrefslogtreecommitdiffstats
path: root/src/buffer.c
diff options
context:
space:
mode:
authorMattias EngdegÄrd2023-04-14 18:26:27 +0200
committerMattias EngdegÄrd2023-04-14 19:34:23 +0200
commitc60b59e04c3776a90adaa8c8fe53af3075a833b8 (patch)
tree55b5586eee1749ef451982b5edcf4f65666d0b9c /src/buffer.c
parentdc842a71ed035dab1115f2e67d35dd07410e18be (diff)
downloademacs-c60b59e04c3776a90adaa8c8fe53af3075a833b8.tar.gz
emacs-c60b59e04c3776a90adaa8c8fe53af3075a833b8.zip
Disallow creation of circular variable alias chains
Make `defvaralias` signal an error upon attempts to create variable alias cycles. This detects errors earlier and makes the alias traversal during execution simpler and faster since no cycle detection is needed elsewhere. Now variable and function aliases are handled identically in these respects. * src/lisp.h (indirect_variable): Remove declaration. * src/data.c (indirect_variable): Remove. (Findirect_variable): Update doc string. Simplify alias resolution. (Fboundp, find_symbol_value, set_internal, default_value) (set_default_internal, Fmake_variable_buffer_local) (Fmake_local_variable, Fkill_local_variable, Flocal_variable_p) (Flocal_variable_if_set_p, Fvariable_binding_locus): * src/buffer.c (buffer_local_value): * src/eval.c (specbind): Simplify variable alias resolution. (Fdefvaralias): Update doc string. Check for cycles. * doc/lispref/variables.texi (Variable Aliases): Mention that `defvaralias` can signal `cyclic-variable-indirection` but `indirect-variable` cannot. * etc/NEWS: Announce the change. * test/src/eval-tests.el (eval-tests-defvaralias): New test.
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/buffer.c b/src/buffer.c
index 31c08cf3650..3e3be805a6d 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -1307,7 +1307,7 @@ buffer_local_value (Lisp_Object variable, Lisp_Object buffer)
1307 start: 1307 start:
1308 switch (sym->u.s.redirect) 1308 switch (sym->u.s.redirect)
1309 { 1309 {
1310 case SYMBOL_VARALIAS: sym = indirect_variable (sym); goto start; 1310 case SYMBOL_VARALIAS: sym = SYMBOL_ALIAS (sym); goto start;
1311 case SYMBOL_PLAINVAL: result = SYMBOL_VAL (sym); break; 1311 case SYMBOL_PLAINVAL: result = SYMBOL_VAL (sym); break;
1312 case SYMBOL_LOCALIZED: 1312 case SYMBOL_LOCALIZED:
1313 { /* Look in local_var_alist. */ 1313 { /* Look in local_var_alist. */