diff options
| author | Stefan Monnier | 2017-10-20 16:04:02 -0400 |
|---|---|---|
| committer | Glenn Morris | 2017-10-20 16:58:32 -0400 |
| commit | ef3d8505ecc0d44517abc82ec2be04f4bb286bd6 (patch) | |
| tree | 2c72c1f7878fe57785dc149a277d4f7d65a3e4de | |
| parent | 11bd8aa24b347f75e674528dd1a94b0a4037105e (diff) | |
| download | emacs-ef3d8505ecc0d44517abc82ec2be04f4bb286bd6.tar.gz emacs-ef3d8505ecc0d44517abc82ec2be04f4bb286bd6.zip | |
* lisp/help-fns.el (describe-function-1):
Fix help-fns-test-dangling-alias. (Bug#28918)
(cherry picked from commit e1d42f8f4a945669ff8b5159a569cb4b18f56e18)
| -rw-r--r-- | lisp/help-fns.el | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/lisp/help-fns.el b/lisp/help-fns.el index d75fec2b564..dfff8be2a6a 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el | |||
| @@ -561,6 +561,8 @@ FILE is the file where FUNCTION was probably defined." | |||
| 561 | short)) | 561 | short)) |
| 562 | 562 | ||
| 563 | (defun help-fns--analyse-function (function) | 563 | (defun help-fns--analyse-function (function) |
| 564 | ;; FIXME: Document/explain the differences between FUNCTION, | ||
| 565 | ;; REAL-FUNCTION, DEF, and REAL-DEF. | ||
| 564 | "Return information about FUNCTION. | 566 | "Return information about FUNCTION. |
| 565 | Returns a list of the form (REAL-FUNCTION DEF ALIASED REAL-DEF)." | 567 | Returns a list of the form (REAL-FUNCTION DEF ALIASED REAL-DEF)." |
| 566 | (let* ((advised (and (symbolp function) | 568 | (let* ((advised (and (symbolp function) |
| @@ -689,10 +691,15 @@ Returns a list of the form (REAL-FUNCTION DEF ALIASED REAL-DEF)." | |||
| 689 | (point)))) | 691 | (point)))) |
| 690 | (terpri)(terpri) | 692 | (terpri)(terpri) |
| 691 | 693 | ||
| 692 | (pcase-let ((`(,real-function ,def ,_aliased ,real-def) | 694 | (pcase-let* ((`(,real-function ,def ,_aliased ,real-def) |
| 693 | (help-fns--analyse-function function)) | 695 | (help-fns--analyse-function function)) |
| 694 | (doc-raw (documentation function t)) | 696 | (doc-raw (condition-case nil |
| 695 | (key-bindings-buffer (current-buffer))) | 697 | ;; FIXME: Maybe `documentation' should return nil |
| 698 | ;; for invalid functions i.s.o. signaling an error. | ||
| 699 | (documentation function t) | ||
| 700 | ;; E.g. an alias for a not yet defined function. | ||
| 701 | (invalid-function nil))) | ||
| 702 | (key-bindings-buffer (current-buffer))) | ||
| 696 | 703 | ||
| 697 | ;; If the function is autoloaded, and its docstring has | 704 | ;; If the function is autoloaded, and its docstring has |
| 698 | ;; key substitution constructs, load the library. | 705 | ;; key substitution constructs, load the library. |
| @@ -703,10 +710,15 @@ Returns a list of the form (REAL-FUNCTION DEF ALIASED REAL-DEF)." | |||
| 703 | 710 | ||
| 704 | (help-fns--key-bindings function) | 711 | (help-fns--key-bindings function) |
| 705 | (with-current-buffer standard-output | 712 | (with-current-buffer standard-output |
| 706 | (let ((doc (help-fns--signature | 713 | (let ((doc (condition-case nil |
| 707 | function doc-raw | 714 | ;; FIXME: Maybe `help-fns--signature' should return `doc' |
| 708 | (if (subrp def) (indirect-function real-def) real-def) | 715 | ;; for invalid functions i.s.o. signaling an error. |
| 709 | real-function key-bindings-buffer))) | 716 | (help-fns--signature |
| 717 | function doc-raw | ||
| 718 | (if (subrp def) (indirect-function real-def) real-def) | ||
| 719 | real-function key-bindings-buffer) | ||
| 720 | ;; E.g. an alias for a not yet defined function. | ||
| 721 | (invalid-function doc-raw)))) | ||
| 710 | (run-hook-with-args 'help-fns-describe-function-functions function) | 722 | (run-hook-with-args 'help-fns-describe-function-functions function) |
| 711 | (insert "\n" (or doc "Not documented."))) | 723 | (insert "\n" (or doc "Not documented."))) |
| 712 | ;; Avoid asking the user annoying questions if she decides | 724 | ;; Avoid asking the user annoying questions if she decides |