updated on Wed Jan 11 00:07:16 UTC 2012
[aur-mirror.git] / dictcn / dictcn.el
blobffbf3bdc64e740c183e2c2626c05a30a0db88d0e
1 ;; If you want to use dictcn-script in emacs,
2 ;; put this file into your load-path and the following into your
3 ;; ~/.emacs:
4 ;; (require 'dictcn)
5 ;; (define-key global-map (kbd "C-c d") 'dictcn-lookup)
7 (provide 'dictcn)
8 (defun dictcn-lookup (pronounce-p)
9 "Prompt for a word to look up in dict.cn.
10 When provided with a prefix argument, pronounce the word
11 `sdcv-dictionary-list' before search."
12 (interactive "P")
13 (let* ((guess (or (and transient-mark-mode mark-active
14 (buffer-substring-no-properties
15 (region-beginning)
16 (region-end)))
17 (current-word nil t)))
18 (word (read-string (format "dict.cn (default: %s): " guess)
19 nil nil guess)))
20 (shell-command (concat "dictcn -w \"" word "\"" (if pronounce-p " -p " ""))
21 "*dictcn*")))