Created
September 16, 2012 17:05
-
-
Save masutaka/3733250 to your computer and use it in GitHub Desktop.
A dictionary tool which can switch Mac dictionary, sdic and commandline-dictionary-app.
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
| ;; http://www.namazu.org/~tsuchiya/sdic/index.html | |
| (require 'sdic) | |
| ;; hg clone http://hg.pqrs.org/commandline-dictionary-app | |
| (defvar dict-bin "/Users/masutaka/repository/commandline-dictionary-app/src/dict" | |
| "a path of commandline-dictionary-app") | |
| (defun dictionary-app (word) | |
| "Display the meaning of word using Dictionary.app." | |
| (interactive (list (sdic-read-from-minibuffer))) | |
| (set-buffer (get-buffer-create sdic-buffer-name)) | |
| (or (string= mode-name sdic-mode-name) (sdic-mode)) | |
| (setq buffer-read-only nil) | |
| (erase-buffer) | |
| (insert (format "============================================================\n%s\n" word)) | |
| (call-process dict-bin | |
| nil sdic-buffer-name t word | |
| "Japanese-English" "Japanese" "Japanese Synonyms") | |
| (setq buffer-read-only t) | |
| (set-buffer-modified-p nil) | |
| (sdic-display-buffer 0)) | |
| (defun dictionary-search (word) | |
| (browse-url | |
| (concat "dict:///" (url-hexify-string word)))) | |
| (defun my-dictionary (arg) | |
| (interactive "P") | |
| (cond | |
| ((equal arg '(16)) | |
| (dictionary-app (sdic-read-from-minibuffer))) | |
| ((equal arg '(4)) | |
| (sdic-describe-word (sdic-read-from-minibuffer))) | |
| (t | |
| (dictionary-search (sdic-read-from-minibuffer))))) |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The detail is the following.
http://masutaka.net/chalow/2012-09-17-1.html