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
2 changed files with 10 additions and 5 deletions
|
@ -829,11 +829,7 @@ Returns a list of the form (REAL-FUNCTION DEF ALIASED REAL-DEF)."
|
||||||
(symbol-name function)))))))
|
(symbol-name function)))))))
|
||||||
(real-def (cond
|
(real-def (cond
|
||||||
((and aliased (not (subrp def)))
|
((and aliased (not (subrp def)))
|
||||||
(let ((f real-function))
|
(car (function-alias-p real-function t)))
|
||||||
(while (and (fboundp f)
|
|
||||||
(symbolp (symbol-function f)))
|
|
||||||
(setq f (symbol-function f)))
|
|
||||||
f))
|
|
||||||
((subrp def) (intern (subr-name def)))
|
((subrp def) (intern (subr-name def)))
|
||||||
(t 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 'defface))
|
||||||
(should-not (find-lisp-object-file-name help-fns--test-var 1))))
|
(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
|
;;; help-fns-tests.el ends here
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue