aboutsummaryrefslogtreecommitdiff
path: root/helpful.el
diff options
context:
space:
mode:
authorNick Drozd <nicholasdrozd@gmail.com>2018-08-16 12:13:44 -0500
committerNick Drozd <nicholasdrozd@gmail.com>2018-08-16 13:24:03 -0500
commitd231f4a733083ec33a1e3e1605a2c598b4a4f8be (patch)
tree119f22ec1a278195f05fdca5281ba582f2ab74eb /helpful.el
parent408acb9872b80bc6f16dcca031f4ceb74a9acb5e (diff)
Sort callees into (compound) functions and primitives
Addresses #150 (at least partially)
Diffstat (limited to 'helpful.el')
-rw-r--r--helpful.el20
1 files changed, 18 insertions, 2 deletions
diff --git a/helpful.el b/helpful.el
index 71b481f..8d0d456 100644
--- a/helpful.el
+++ b/helpful.el
@@ -603,7 +603,9 @@ overrides that to include previously opened buffers."
(if (stringp raw-source)
(read raw-source)
raw-source))
- (syms (helpful--sort-symbols (helpful--callees source))))
+ (syms (helpful--sort-symbols (helpful--callees source)))
+ (primitives (-filter (lambda (sym) (helpful--primitive-p sym t)) syms))
+ (compounds (-remove (lambda (sym) (helpful--primitive-p sym t)) syms)))
(pop-to-buffer buf)
(let ((inhibit-read-only t))
@@ -611,7 +613,7 @@ overrides that to include previously opened buffers."
(insert
;; TODO: Macros used, special forms used, global vars used.
(format "Functions called by %s:\n\n" sym))
- (dolist (sym syms)
+ (dolist (sym compounds)
(insert " "
(helpful--button
(symbol-name sym)
@@ -619,7 +621,21 @@ overrides that to include previously opened buffers."
'symbol sym
'callable-p t)
"\n"))
+
+ (insert "\n")
+
+ (insert (format "Primitives called by %s:\n\n" sym))
+ (dolist (sym primitives)
+ (insert " "
+ (helpful--button
+ (symbol-name sym)
+ 'helpful-describe-exactly-button
+ 'symbol sym
+ 'callable-p t)
+ "\n"))
+
(goto-char (point-min))
+
;; TODO: define our own mode, so we can move between links
;; conveniently.
(special-mode))))