helpful

a fork of Wilfred's helpful
git clone https://git.trogloxene.org/helpful.git
Log | Files | Refs | README

commit c96f6c74957c702be95d99e5929fec350ecd8d0e
parent e0973bfc4d7fce0225cf20e5d4089d729c55f5c2
Author: Wilfred Hughes <me@wilfred.me.uk>
Date:   Sun,  2 Apr 2017 11:48:07 +0100

Show symbol properties too

Diffstat:
Mhelpful.el | 26+++++++++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/helpful.el b/helpful.el @@ -45,6 +45,28 @@ "Propertize TEXT as a heading." (propertize text 'face 'bold)) +(defun helpful--pretty-print (val) + "Pretty-print VALUE. +This allows us to distinguish strings from symbols." + (with-temp-buffer + (cl-prettyprint val) + (s-trim (buffer-string)))) + +(defun helpful--format-properties (symbol) + "Return a string describing all the properties of SYMBOL." + (let* ((syms-and-vals + (-partition 2 (symbol-plist symbol))) + (lines + (--map + (-let [(sym val) it] + (format "%s %s" + (propertize (symbol-name sym) + 'face 'font-lock-constant-face) + (helpful--pretty-print val))) + syms-and-vals))) + (when lines + (s-join "\n" lines)))) + (defun helpful-update () "Update the current *Helpful* buffer to the latest state of the current symbol." @@ -55,7 +77,9 @@ state of the current symbol." (insert (format "Symbol: %s\n\n" helpful--sym) (helpful--heading "Documentation\n") - (helpful--docstring helpful--sym)) + (helpful--docstring helpful--sym) + (helpful--heading "\n\nSymbol Properties\n") + (helpful--format-properties helpful--sym)) (goto-char start-pos))) (defun helpful--skip-advice (docstring)