Skip to content

Instantly share code, notes, and snippets.

@myuhe
Created September 29, 2010 10:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save myuhe/602537 to your computer and use it in GitHub Desktop.
Save myuhe/602537 to your computer and use it in GitHub Desktop.
(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