Created
November 21, 2011 09:39
-
-
Save syohex/1382156 to your computer and use it in GitHub Desktop.
Select document command for each major-mode
This file contains hidden or 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
;; document | |
(defmacro major-mode-eql (mode) | |
`(eql major-mode ,mode)) | |
(defun my/man () | |
(interactive) | |
(let* ((manual-program | |
(cond | |
((or (major-mode-eql 'cperl-mode) (major-mode-eql 'perl-mode)) "perldoc") | |
((or (major-mode-eql 'python-mode) (major-mode-eql 'py-mode)) "pydoc") | |
((major-mode-eql 'ruby-mode) "ri") | |
(t "man"))) | |
(prompt (format "%s entry: " manual-program)) | |
(input (read-string prompt))) | |
(if (not (string= manual-program "man")) | |
(manual-entry input) | |
(man input)))) | |
(global-set-key (kbd "<f1>") 'my/man) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment