Created
July 1, 2009 09:31
-
-
Save yanbe/138704 to your computer and use it in GitHub Desktop.
CHM file support for python-mode on Emacs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; CHM file support for Python help | |
;; Prerequisites: hhh.exe http://saitou155.catfood.jp/hhh.htm | |
;; TODO: support Mac and Linux | |
(require 'python-mode) | |
(defcustom py-chmhelp-path "/Python26/Doc/python262.chm" | |
"path for Python CHM help file" | |
:type 'string | |
:group 'python) | |
(defun py-chmhelp-dotexpr-begin nil | |
(interactive) | |
(re-search-backward "[^a-zA-Z_0-9\\.]") | |
(forward-char)) | |
(defun py-chmhelp-dotexpr-end nil | |
(interactive) | |
(re-search-forward "[a-zA-Z_0-9\\.]*")) | |
(put 'python-dotexpr 'beginning-op 'py-chmhelp-dotexpr-begin) | |
(put 'python-dotexpr 'end-op 'py-chmhelp-dotexpr-end) | |
(defun py-chmhelp-thing-at-point nil | |
(interactive) | |
(require 'thingatpt) | |
(let ((sym (thing-at-point 'python-dotexpr))) | |
(if sym | |
(let* ((module (substring sym 0 (string-match "\\." sym))) | |
(func (substring sym (length module) nil))) | |
(start-process "CHM help" nil "hhh" | |
(concat | |
py-chmhelp-path "::/library/" | |
module ".html#" | |
(if (string-equal func "") | |
(concat "module-" module) | |
(concat module func)))))))) | |
(define-key py-mode-map "\C-cj" 'py-chmhelp-thing-at-point) | |
(provide 'python-chmhelp) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment