helpful

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

commit 7c580c756237c42e5940dd361fe3b8b0d04d58c3
parent b10711efe34f179818aed8c6e0b49f953f55a886
Author: Wilfred Hughes <me@wilfred.me.uk>
Date:   Sun,  2 Apr 2017 19:17:17 +0100

Add disassembly.

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

diff --git a/helpful.el b/helpful.el @@ -89,6 +89,23 @@ This allows us to distinguish strings from symbols." :type 'helpful-forget-button) (buffer-string))) +(define-button-type 'helpful-disassemble-button + 'action #'helpful--disassemble + 'follow-link t + 'help-echo "Show disassembled bytecode") + +(defun helpful--disassemble (_button) + "Disassemble the current symbol." + (disassemble helpful--sym)) + +(defun helpful--disassemble-button () + "Return a button that disassembles the current symbol." + (with-temp-buffer + (insert-text-button + "Disassemble bytecode" + :type 'helpful-disassemble-button) + (buffer-string))) + ;; TODO: consider advising eval-buffer to add the current directory to ;; load-path. ;; TODO: looks like we need to byte-compile the file too, load-path @@ -130,7 +147,9 @@ state of the current symbol." (helpful--heading "\n\nDefinition\n") (if (stringp source) source - (helpful--pretty-print source))) + (helpful--pretty-print source)) + "\n\n" + (helpful--disassemble-button)) (goto-char start-pos))) (defun helpful--skip-advice (docstring)