[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master dce42f5561: * lisp/apropos.el (apropos-safe-documentation): Use `
From: |
Stefan Monnier |
Subject: |
master dce42f5561: * lisp/apropos.el (apropos-safe-documentation): Use `function-documentation` |
Date: |
Fri, 13 Jan 2023 18:00:35 -0500 (EST) |
branch: master
commit dce42f556177e4e0f15daccb3c2f27a47f2beebb
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>
* lisp/apropos.el (apropos-safe-documentation): Use `function-documentation`
---
lisp/apropos.el | 24 +++++++-----------------
1 file changed, 7 insertions(+), 17 deletions(-)
diff --git a/lisp/apropos.el b/lisp/apropos.el
index b260d88995..9b9615221c 100644
--- a/lisp/apropos.el
+++ b/lisp/apropos.el
@@ -1117,23 +1117,13 @@ non-nil."
(defun apropos-safe-documentation (function)
"Like `documentation', except it avoids calling `get_doc_string'.
Will return nil instead."
- (while (and function (symbolp function))
- (setq function (symbol-function function)))
- (if (eq (car-safe function) 'macro)
- (setq function (cdr function)))
- (setq function (if (byte-code-function-p function)
- (if (> (length function) 4)
- (aref function 4))
- (if (autoloadp function)
- (nth 2 function)
- (if (eq (car-safe function) 'lambda)
- (if (stringp (nth 2 function))
- (nth 2 function)
- (if (stringp (nth 3 function))
- (nth 3 function)))))))
- (if (integerp function)
- nil
- function))
+ (when (setq function (indirect-function function))
+ ;; FIXME: `function-documentation' says not to call it, but `documentation'
+ ;; would turn (FILE . POS) references into strings too eagerly, so
+ ;; we do want to use the lower-level function.
+ (let ((doc (function-documentation function)))
+ ;; Docstrings from the DOC file are handled elsewhere.
+ (if (integerp doc) nil doc))))
(defcustom apropos-compact-layout nil
"If non-nil, use a single line per binding."
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master dce42f5561: * lisp/apropos.el (apropos-safe-documentation): Use `function-documentation`,
Stefan Monnier <=