Skip to content

Instantly share code, notes, and snippets.

@myuhe
Created Sep 29, 2010
Embed
What would you like to do?
(defun py-doc-exec ()
(interactive)
(save-current-buffer
(let ((symbol
(with-syntax-table python-dotty-syntax-table (current-word)))
(tmpbuf (get-buffer-create "*py-doc-popup*"))
(enable-recursive-minibuffers t))
(if (equal symbol "") (error "No symbol"))
(set-buffer "*py-doc-popup*")
(comint-redirect-send-command-to-process
(format "emacs.ehelp(%S, %s)"
symbol python-imports) "*py-doc-popup*" (python-proc) nil t))))
(defun py-doc-popup ()
"Get help() for object at point, and display it in a popup."
;; Note that we do this in the inferior process, not a separate one, to
;; ensure the environment is appropriate.
(interactive)
(py-doc-exec)
(let ((curbuf (current-buffer)))
(set-buffer "*py-doc-popup*")
(let ((bs (buffer-string)))
(set-buffer curbuf)
(popup-tip bs))
(kill-buffer "*py-doc-popup*")))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment