EMACS下按关键字查询chm帮助(windows)

首先,需要下载一个叫做KeyHH 的小工具,KeyHH is a program that augments HTML Help. 有了这个工具之后,可以通过如下命令行来按关键字查询帮助

keyhh -MyID -#klink "keyword"  foobar.chm  

于是~/.emacs配置如下就可以了:

;;KeyHH -MyHelp -#klink "ActiveX Control Wizard" htmlhelp.chm
(defun chm-keyword-lookup (typeid help-file)
  "lookup a keyword in a CHM file and display it"
  (interactive) 
  (start-process "CHM keyword lookup" nil 
       "keyhh.exe" 
       (concat "-" typeid) "-#klink" 
       (format "'%s'" (thing-at-point 'symbol)) 
       help-file )
)

;;php
(defun chm-keyword-lookup-php () 
  (interactive)
  (chm-keyword-lookup "PHP" "e:/Apache2.2/php_manual_en.chm")
)

(define-key php-mode-map (kbd "C-h C-k") 'chm-keyword-lookup-php )

;;python
(defun chm-keyword-lookup-py () 
  (interactive)
  (chm-keyword-lookup "PYTHON" "e:/Python24/Doc/ActivePython24.chm")
)

(define-key py-mode-map (kbd "C-h C-k") 'chm-keyword-lookup-py )
 
 

BTW: 对于.hlp文件可以用:

winhlp32 -k keyword  path/to/foobar.hlp