Just add the following stuff in your .emacs.
and type Ctrl-h f at point where you want to look up pydoc.
;;----pydoc lookup---- (defun hohe2-lookup-pydoc () (interactive) (let ((curpoint (point)) (prepoint) (postpoint) (cmd)) (save-excursion (beginning-of-line) (setq prepoint (buffer-substring (point) curpoint))) (save-excursion (end-of-line) (setq postpoint (buffer-substring (point) curpoint))) (if (string-match "[_a-z][_\\.0-9a-z]*$" prepoint) (setq cmd (substring prepoint (match-beginning 0) (match-end 0)))) (if (string-match "^[_0-9a-z]*" postpoint) (setq cmd (concat cmd (substring postpoint (match-beginning 0) (match-end 0))))) (if (string= cmd "") nil (let ((max-mini-window-height 0)) (shell-command (concat "pydoc " cmd)))))) (add-hook 'python-mode-hook (lambda () (local-set-key (kbd "C-h f") 'hohe2-lookup-pydoc)))
I had been thinking that Python is a toy and the rest of the programming languages are all tools, but I realized Emacs Lisp is a toy too. I'm sure I'm reinventing a wheel. Don't worry!
No comments:
Post a Comment