]> git.eshelyaron.com Git - emacs.git/commit
Detect and prevent function alias loops in `fset` and `defalias`
authorMattias Engdegård <mattiase@acm.org>
Mon, 20 Feb 2023 14:23:12 +0000 (15:23 +0100)
committerMattias Engdegård <mattiase@acm.org>
Tue, 21 Feb 2023 09:42:00 +0000 (10:42 +0100)
commitdb3fea2e5ce46229ae40aa9ca6a89964261a7a5a
tree43264b77f2bc165a310090c40065ee6dfc750169
parentc4c4af022d6091537fb0d748342eba5e7d3ddd23
Detect and prevent function alias loops in `fset` and `defalias`

Make `fset` and `defalias` signal an error on attempts to create
circular alias chains.  This is more effective, efficient and
convenient than permitting alias loops to be created and trying to
detect them at run time each time a function is called, which is what
we have been doing until now, badly.

* lisp/help-fns.el (help-fns--analyze-function):
Don't pass obsolete argument.
* lisp/subr.el (function-alias-p):
* src/data.c (indirect_function, Findirect_function): Simplify.
Now error-free, second argument obsolete.
(Ffset): Detect loops.
* test/lisp/help-fns-tests.el (help-fns--analyze-function-recursive):
* test/lisp/subr-tests.el (test-alias-p):
Adapt tests.
* test/src/data-tests.el (data-tests-fset, data-tests-defalias): New.
* doc/lispref/eval.texi (Function Indirection):
* doc/lispref/functions.texi (Defining Functions, Function Cells):
Update manual.
* etc/NEWS: Announce.
doc/lispref/eval.texi
doc/lispref/functions.texi
etc/NEWS
lisp/help-fns.el
lisp/subr.el
src/data.c
src/eval.c
test/lisp/help-fns-tests.el
test/lisp/subr-tests.el
test/src/data-tests.el