From 9d8e7f3c3a44ac0f2bc7b0438c31226481476aff Mon Sep 17 00:00:00 2001 From: Wilfred Hughes Date: Sun, 7 Apr 2019 21:54:23 +0100 Subject: Don't show the Source Code heading if we don't have any source --- helpful.el | 51 +++++++++++++++++++++++++-------------------------- 1 file 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 -- cgit v1.0