mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-11-27 07:37:33 +00:00
Avoid infloops in help-fns--analyze-function with aliases
* lisp/help-fns.el (help-fns--analyze-function): Use function-alias-p to avoid infloops.
This commit is contained in:
parent
c8a2af3037
commit
d30fde6b0c
@ -829,11 +829,7 @@ Returns a list of the form (REAL-FUNCTION DEF ALIASED REAL-DEF)."
|
||||
(symbol-name function)))))))
|
||||
(real-def (cond
|
||||
((and aliased (not (subrp def)))
|
||||
(let ((f real-function))
|
||||
(while (and (fboundp f)
|
||||
(symbolp (symbol-function f)))
|
||||
(setq f (symbol-function f)))
|
||||
f))
|
||||
(car (function-alias-p real-function t)))
|
||||
((subrp def) (intern (subr-name def)))
|
||||
(t def))))
|
||||
|
||||
|
@ -177,4 +177,13 @@ Return first line of the output of (describe-function-1 FUNC)."
|
||||
(should-not (find-lisp-object-file-name help-fns--test-var 'defface))
|
||||
(should-not (find-lisp-object-file-name help-fns--test-var 1))))
|
||||
|
||||
(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))))
|
||||
|
||||
;;; help-fns-tests.el ends here
|
||||
|
Loading…
Reference in New Issue
Block a user