summaryrefslogtreecommitdiff
path: root/lisp/help-fns.el
diff options
context:
space:
mode:
authorMattias EngdegÄrd <mattiase@acm.org>2023-02-20 15:23:12 +0100
committerMattias EngdegÄrd <mattiase@acm.org>2023-02-21 10:42:00 +0100
commitdb3fea2e5ce46229ae40aa9ca6a89964261a7a5a (patch)
tree43264b77f2bc165a310090c40065ee6dfc750169 /lisp/help-fns.el
parentc4c4af022d6091537fb0d748342eba5e7d3ddd23 (diff)
downloademacs-db3fea2e5ce46229ae40aa9ca6a89964261a7a5a.tar.gz
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.
Diffstat (limited to 'lisp/help-fns.el')
-rw-r--r--lisp/help-fns.el2
1 files changed, 1 insertions, 1 deletions
diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index 8bf8af73d30..1172f068934 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -996,7 +996,7 @@ Returns a list of the form (REAL-FUNCTION DEF ALIASED REAL-DEF)."
(symbol-name function)))))))
(real-def (cond
((and aliased (not (subrp def)))
- (car (function-alias-p real-function t)))
+ (car (function-alias-p real-function)))
((subrp def) (intern (subr-name def)))
(t def))))