mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
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.
This commit is contained in:
parent
c4c4af022d
commit
db3fea2e5c
10 changed files with 103 additions and 89 deletions
|
|
@ -180,10 +180,6 @@ Return first line of the output of (describe-function-1 FUNC)."
|
|||
|
||||
(ert-deftest help-fns--analyze-function-recursive ()
|
||||
(defalias 'help-fns--a 'help-fns--b)
|
||||
(should (equal (help-fns--analyze-function 'help-fns--a)
|
||||
'(help-fns--a help-fns--b t help-fns--b)))
|
||||
;; Make a loop and see that it doesn't infloop.
|
||||
(defalias 'help-fns--b 'help-fns--a)
|
||||
(should (equal (help-fns--analyze-function 'help-fns--a)
|
||||
'(help-fns--a help-fns--b t help-fns--b))))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue