Tooltips for SLIME

25 May 2008 (programming lisp)

I came across tooltip-help.el while browsing EmacsWiki for useful SLIME scripts. I tried it out with elisp and it's really great, so I wanted to do something similar for SLIME.

First, you need a trivial change to tooltip-help.el so that the result can come from any buffer, not just *Help*. The problem, then, is that SLIME's slime-describe-symbol is an asynchronous operation, so the *SLIME Description* buffer is not yet ready when th-elisp-get-help-text tries to read the description from it. So here's a synchronous version:

(defun slime-describe-symbol-sync (symbol-name)
  (unless symbol-name
    (error "No symbol given"))
  
  (with-current-buffer (slime-output-buffer)
    (slime-with-output-end-mark (slime-mark-output-start)))
  (let ((package (slime-current-package))
        (result (slime-eval `(swank:describe-symbol ,symbol-name))))
    (with-current-buffer (slime-output-buffer)
      (slime-show-last-output)
      (slime-show-description result package))))

(defun th-lisp-mode-handler ()           
  (th-elisp-get-help-text #'slime-describe-symbol-sync (current-word)
                          "*SLIME Description*"))

« Indi János és az ajkai kristályszuvenírek 
All entries
 Nyomkodom a "Műköggyé" gombot »