aboutsummaryrefslogtreecommitdiff
path: root/helpful.el
diff options
context:
space:
mode:
authorWilfred Hughes <me@wilfred.me.uk>2019-03-03 22:43:55 +0000
committerWilfred Hughes <me@wilfred.me.uk>2019-03-03 22:43:55 +0000
commita20eef8fd3fb33abe35dd2ed1590184bc2975b69 (patch)
treecfe0e567e5ec1060be594c0134749b8ca36f006f /helpful.el
parent72e93276fc0032e434f2acf62d8d63d51557e55b (diff)
Always autoload callables if they aren't loaded0.16
Fixes #117
Diffstat (limited to 'helpful.el')
-rw-r--r--helpful.el9
1 files changed, 9 insertions, 0 deletions
diff --git a/helpful.el b/helpful.el
index efbe1d3..828be1b 100644
--- a/helpful.el
+++ b/helpful.el
@@ -1926,6 +1926,14 @@ may contain duplicates."
(-flatten
(-map #'helpful--callees-1 (cdr form)))))))
+(defun helpful--ensure-loaded ()
+ "Ensure the symbol associated with the current buffer has been loaded."
+ (when (and helpful--callable-p
+ (symbolp helpful--sym))
+ (let ((fn-obj (helpful--without-advice helpful--sym)))
+ (when (autoloadp fn-obj)
+ (autoload-do-load fn-obj)))))
+
(defun helpful-update ()
"Update the current *Helpful* buffer to the latest
state of the current symbol."
@@ -1933,6 +1941,7 @@ state of the current symbol."
(cl-assert (not (null helpful--sym)))
(unless (buffer-live-p helpful--associated-buffer)
(setq helpful--associated-buffer nil))
+ (helpful--ensure-loaded)
(-let* ((val
;; Look at the value before setting `inhibit-read-only', so
;; users can see the correct value of that variable.