commit d167ee6fd4fbaadc46aa50a96529dc234a4c37c2 parent 6ecf75d67e6099b6128b00cae7ff06b5190a82a5 Author: Wilfred Hughes <me@wilfred.me.uk> Date: Sat, 22 Jul 2017 13:22:02 +0100 Only show docs or props if we have something to show Diffstat:
| M | helpful.el | | | 25 | +++++++++++++------------ |
1 file changed, 13 insertions(+), 12 deletions(-)
diff --git a/helpful.el b/helpful.el @@ -452,18 +452,18 @@ state of the current symbol." (kill-buffer buf))) (erase-buffer) (insert - (helpful--heading (if (macrop helpful--sym) "Macro Signature\n" "Function Signature\n")) - (helpful--signature helpful--sym) - (helpful--heading "\n\nDocumentation\n") - ;; TODO: a link to find this symbol in the manual, much like - ;; helpfns+ or counsel-info-lookup-symbol. - (-if-let (docstring (helpful--docstring helpful--sym)) - (helpful--format-docstring docstring) - "No docstring.")) + (helpful--signature helpful--sym)) + + (-when-let (docstring (helpful--docstring helpful--sym)) + (insert + (helpful--heading "\n\nDocumentation\n") + ;; TODO: a link to find this symbol in the manual, much like + ;; helpfns+ or counsel-info-lookup-symbol. + (helpful--format-docstring docstring))) ;; Show keybindings. ;; TODO: allow users to conveniently add and remove keybindings. @@ -487,11 +487,12 @@ state of the current symbol." (t "Could not find source file.")) "\n\n" - (helpful--all-references-button helpful--sym) + (helpful--all-references-button helpful--sym)) - (helpful--heading "\n\nSymbol Properties\n") - (or (helpful--format-properties helpful--sym) - "No properties.")) + (-when-let (formatted-props (helpful--format-properties helpful--sym)) + (insert + (helpful--heading "\n\nSymbol Properties\n") + formatted-props)) (when (helpful--advised-p helpful--sym) (insert