diff options
| author | Stefan Monnier | 2023-01-13 18:00:29 -0500 |
|---|---|---|
| committer | Stefan Monnier | 2023-01-13 18:00:29 -0500 |
| commit | dce42f556177e4e0f15daccb3c2f27a47f2beebb (patch) | |
| tree | 2e7b84c7a0519716f51123fba02fed739be8aa0f | |
| parent | f5d8aa6edacc8f4d06bb78010e408034b83f98e0 (diff) | |
| download | emacs-dce42f556177e4e0f15daccb3c2f27a47f2beebb.tar.gz emacs-dce42f556177e4e0f15daccb3c2f27a47f2beebb.zip | |
* lisp/apropos.el (apropos-safe-documentation): Use `function-documentation`
| -rw-r--r-- | lisp/apropos.el | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/lisp/apropos.el b/lisp/apropos.el index b260d889955..9b9615221ca 100644 --- a/lisp/apropos.el +++ b/lisp/apropos.el | |||
| @@ -1117,23 +1117,13 @@ non-nil." | |||
| 1117 | (defun apropos-safe-documentation (function) | 1117 | (defun apropos-safe-documentation (function) |
| 1118 | "Like `documentation', except it avoids calling `get_doc_string'. | 1118 | "Like `documentation', except it avoids calling `get_doc_string'. |
| 1119 | Will return nil instead." | 1119 | Will return nil instead." |
| 1120 | (while (and function (symbolp function)) | 1120 | (when (setq function (indirect-function function)) |
| 1121 | (setq function (symbol-function function))) | 1121 | ;; FIXME: `function-documentation' says not to call it, but `documentation' |
| 1122 | (if (eq (car-safe function) 'macro) | 1122 | ;; would turn (FILE . POS) references into strings too eagerly, so |
| 1123 | (setq function (cdr function))) | 1123 | ;; we do want to use the lower-level function. |
| 1124 | (setq function (if (byte-code-function-p function) | 1124 | (let ((doc (function-documentation function))) |
| 1125 | (if (> (length function) 4) | 1125 | ;; Docstrings from the DOC file are handled elsewhere. |
| 1126 | (aref function 4)) | 1126 | (if (integerp doc) nil doc)))) |
| 1127 | (if (autoloadp function) | ||
| 1128 | (nth 2 function) | ||
| 1129 | (if (eq (car-safe function) 'lambda) | ||
| 1130 | (if (stringp (nth 2 function)) | ||
| 1131 | (nth 2 function) | ||
| 1132 | (if (stringp (nth 3 function)) | ||
| 1133 | (nth 3 function))))))) | ||
| 1134 | (if (integerp function) | ||
| 1135 | nil | ||
| 1136 | function)) | ||
| 1137 | 1127 | ||
| 1138 | (defcustom apropos-compact-layout nil | 1128 | (defcustom apropos-compact-layout nil |
| 1139 | "If non-nil, use a single line per binding." | 1129 | "If non-nil, use a single line per binding." |