commit 7ec9bfc110e905abdceaac9016e12aa2d849700c parent 8fe0c499afc1a7058f580f9e7f49aee5da39837c Author: Wilfred Hughes <me@wilfred.me.uk> Date: Sat, 1 Apr 2017 19:44:34 +0100 Basic rendering Diffstat:
| M | helpful.el | | | 23 | ++++++++++++++++++++--- |
1 file changed, 20 insertions(+), 3 deletions(-)
diff --git a/helpful.el b/helpful.el @@ -24,15 +24,32 @@ ;;; Code: +(defvar-local helpful--sym nil) + +(defun helpful--buffer (symbol) + "Return a buffer to show help for SYMBOL in." + (let ((buf (get-buffer-create + (format "*helpful: %s" symbol)))) + (with-current-buffer buf + (setq helpful--sym symbol)))) + +(defun helpful--update (fn-symbol) + "Update the current *insight* buffer to the latest state of FN-SYMBOL." + (let ((inhibit-read-only t) + (start-pos (point))) + (erase-buffer) + (insert + (format "Symbol: %s\n" fn-symbol)) + (goto-char start-pos))) + (defun helpful (symbol) "Show Help for SYMBOL." (interactive (list (completing-read "Symbol: " obarray nil nil nil nil (symbol-name (symbol-at-point))))) - ) - - + (switch-to-buffer (helpful--buffer symbol)) + (helpful--update symbol)) (provide 'helpful) ;;; helpful.el ends here