helpful

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

commit 5298a6ec80aa76613d852c7568c693fc76a4d23d
parent 4ec88fd125c2c3100d9aa9ed3191ca482c0ade2f
Author: Wilfred Hughes <me@wilfred.me.uk>
Date:   Sat, 30 Dec 2017 10:58:40 +0000

Offer disassembly of symbol properties too

Diffstat:
Mhelpful.el | 21++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/helpful.el b/helpful.el @@ -227,10 +227,19 @@ Return SYM otherwise." (-let* (((sym val) it) (pretty-val (helpful--pretty-print val))) - (format "%s\n%s" + (format "%s\n%s%s" (propertize (symbol-name sym) 'face 'font-lock-constant-face) - (helpful--indent-rigidly pretty-val 2))) + (helpful--indent-rigidly pretty-val 2) + ;; Also offer to disassemble byte-code + ;; properties. + (if (byte-code-function-p val) + (format "\n %s" + (helpful--button + "Disassemble" + 'helpful-disassemble-button + 'object val)) + ""))) syms-and-vals))) (when lines (s-join "\n" lines)))) @@ -274,12 +283,14 @@ source code to primitives." (define-button-type 'helpful-disassemble-button 'action #'helpful--disassemble 'follow-link t - 'symbol nil + 'object nil 'help-echo "Show disassembled bytecode") (defun helpful--disassemble (button) "Disassemble the current symbol." - (disassemble (button-get button 'symbol))) + ;; `disassemble' can handle both symbols (e.g. 'when) and raw + ;; byte-code objects. + (disassemble (button-get button 'object))) (define-button-type 'helpful-edebug-button 'action #'helpful--edebug @@ -1120,7 +1131,7 @@ state of the current symbol." (helpful--button "Disassemble" 'helpful-disassemble-button - 'symbol helpful--sym))) + 'object helpful--sym))) (when can-forget (when can-disassemble