[Python-mode] elisp submission

truenolejano at yahoo.com truenolejano at yahoo.com
Wed Dec 1 14:07:19 CET 2004


I use the following with your emacs python mode
and thought I'd share.

---

(defun pydoc-class ()
  "run pydoc on class at point"
  (interactive)
  (setq class (thing-at-point `word))
  (setq query class)
  (call-process "pydoc" nil "pydoc" nil query)
  (split-window-vertically)
  (switch-to-buffer "pydoc")
  (shrink-window-if-larger-than-buffer)
  (beginning-of-buffer)
)

(defun pydoc-method ()
  "run pydoc on class...method at point"
  (interactive)
  (backward-word 1)
  (setq beg (point))
  (search-forward "(")
  (backward-char)
  (setq end (point))
  (setq query (buffer-substring beg end))
  (message query)
  (call-process "pydoc" nil "pydoc" nil query)
  (split-window-vertically)
  (switch-to-buffer "pydoc")
  (shrink-window-if-larger-than-buffer)
  (beginning-of-buffer)
)

(defun pydoc-close ()
  "rm pydoc window"
  (interactive)
  (delete-window)
  (kill-buffer "pydoc")
)

(define-key py-mode-map "\M-1" 'pydoc-class)
(define-key py-mode-map "\M-2" 'pydoc-method)
(define-key global-map "\M-3" 'pydoc-close)


-- 
-   Friend of All the World
--

There is neither Jew nor Greek, there is neither 
bond nor free, there is neither male nor female: 
for ye are all one in Christ Jesus. And if ye be 
Christ's, then are ye Abraham's seed, and heirs 
according to the promise.    [Galatians 3:28-29]



More information about the Python-mode mailing list