aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilfred Hughes <me@wilfred.me.uk>2020-05-06 01:16:42 -0700
committerGitHub <noreply@github.com>2020-05-06 01:16:42 -0700
commitc0662aa07266fe204f4e6d72ccaa6af089400556 (patch)
tree80094b55eed5e1e852e6564c7652257594368ab6
parentc54e9ddbd6a77858048c1a4c4b549de98af8f88e (diff)
parent10943c3593901d6891ecf2350bc7eed4d560e146 (diff)
Merge pull request #240 from xeals/master
Add support for natively-compiled functions
-rw-r--r--helpful.el18
1 files changed, 17 insertions, 1 deletions
diff --git a/helpful.el b/helpful.el
index 20713d2..07c7b74 100644
--- a/helpful.el
+++ b/helpful.el
@@ -1633,7 +1633,9 @@ POSITION-HEADS takes the form ((123 (defun foo)) (456 (defun bar)))."
((and callable-p (helpful--advised-p sym))
(subrp (helpful--without-advice sym)))
(callable-p
- (subrp (indirect-function sym)))
+ (and (not (and (fboundp 'subr-native-elisp-p)
+ (subr-native-elisp-p (indirect-function sym))))
+ (subrp (indirect-function sym))))
(t
(let ((filename (find-lisp-object-file-name sym 'defvar)))
(or (eq filename 'C-source)
@@ -1803,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
@@ -1858,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"
@@ -1867,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