commit 10943c3593901d6891ecf2350bc7eed4d560e146
parent 3a9ada2b46264e271923b7dbcbc219f2e360bc22
Author: xeals <dev@xeal.me>
Date: Mon, 4 May 2020 23:31:41 +1000
Add "natively compiled" info to summary
Diffstat:
1 file changed, 14 insertions(+), 0 deletions(-)
diff --git a/helpful.el b/helpful.el
@@ -1805,6 +1805,12 @@ OBJ may be a symbol or a compiled function object."
(and (symbolp sym)
(byte-code-function-p (symbol-function sym))))
+(defun helpful--native-compiled-p (sym)
+ "Return non-nil if function SYM is native-compiled"
+ (and (symbolp sym)
+ (fboundp 'subr-native-elisp-p)
+ (subr-native-elisp-p (symbol-function sym))))
+
(defun helpful--join-and (items)
"Join a list of strings with commas and \"and\"."
(cond
@@ -1860,6 +1866,11 @@ OBJ may be a symbol or a compiled function object."
"compiled"
'helpful-info-button
'info-node "(elisp)Byte Compilation"))
+ (native-compiled-button
+ (helpful--button
+ "natively compiled"
+ 'helpful-describe-button
+ 'symbol 'native-compile))
(buffer-local-button
(helpful--button
"buffer-local"
@@ -1869,12 +1880,15 @@ OBJ may be a symbol or a compiled function object."
(and callable-p buf (helpful--autoloaded-p sym buf)))
(compiled-p
(and callable-p (helpful--compiled-p sym)))
+ (native-compiled-p
+ (and callable-p (helpful--native-compiled-p sym)))
(buttons
(list
(if alias-p alias-button)
(if (and callable-p autoloaded-p) autoload-button)
(if (and callable-p (commandp sym)) interactive-button)
(if compiled-p compiled-button)
+ (if native-compiled-p native-compiled-button)
(if (and (not callable-p) (local-variable-if-set-p sym))
buffer-local-button)))
(description