aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilfred Hughes <me@wilfred.me.uk>2019-04-07 21:54:23 +0100
committerWilfred Hughes <me@wilfred.me.uk>2019-04-07 21:54:23 +0100
commit9d8e7f3c3a44ac0f2bc7b0438c31226481476aff (patch)
treeda990bf403ca5e2e68918aa5194a36393fb26685
parent67b7592f970776776d243cacf7363eb93bc28ebc (diff)
Don't show the Source Code heading if we don't have any source
-rw-r--r--helpful.el51
1 files changed, 25 insertions, 26 deletions
diff --git a/helpful.el b/helpful.el
index a88031a..9bae444 100644
--- a/helpful.el
+++ b/helpful.el
@@ -2200,32 +2200,31 @@ state of the current symbol."
(helpful--insert-section-break)
- (insert
- (helpful--heading
- (if (eq helpful--sym canonical-sym)
- "Source Code"
- "Alias Source Code"))
- (cond
- (source-path
- (concat
- (propertize (format "%s Defined in " (if primitive-p "//" ";;"))
- 'face 'font-lock-comment-face)
- (helpful--navigate-button
- (f-abbrev source-path)
- source-path
- pos)
- "\n"))
- (primitive-p
- (concat
- (propertize
- "C code is not yet loaded."
- 'face 'font-lock-comment-face)
- "\n\n"
- (helpful--button
- "Set C source directory"
- 'helpful-c-source-directory)))
- (t
- "")))
+ (when (or source-path primitive-p)
+ (insert
+ (helpful--heading
+ (if (eq helpful--sym canonical-sym)
+ "Source Code"
+ "Alias Source Code"))
+ (cond
+ (source-path
+ (concat
+ (propertize (format "%s Defined in " (if primitive-p "//" ";;"))
+ 'face 'font-lock-comment-face)
+ (helpful--navigate-button
+ (f-abbrev source-path)
+ source-path
+ pos)
+ "\n"))
+ (primitive-p
+ (concat
+ (propertize
+ "C code is not yet loaded."
+ 'face 'font-lock-comment-face)
+ "\n\n"
+ (helpful--button
+ "Set C source directory"
+ 'helpful-c-source-directory))))))
(when source
(insert
(cond