From 2a6b19e59d4f50cb5b25c04fba0485088badcf9a Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Sun, 19 Jan 2014 00:10:16 +0900 Subject: [PATCH] add ms translater, not works --- emacs.el | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/emacs.el b/emacs.el index 7f38995..987040d 100644 --- a/emacs.el +++ b/emacs.el @@ -2430,8 +2430,25 @@ result for that word.") (shell-command-to-string (format "dict_app '%s'" word)))) + ("ms" . + (lambda (word) + (let ((url (concat "http://api.microsofttranslator.com/V2/Ajax.svc/" + "Translate?appId=%s&text=%s&to=%s")) + (apikey "3C9778666C5BA4B406FFCBEE64EF478963039C51") + (target "ja") + (eword (url-hexify-string word))) + (with-current-buffer (url-retrieve-synchronously + (format url + apikey + eword + target)) + ;; (search-forward-regexp "^$") + (buffer-substring-no-properties (point) + (point-max)))))) )) +;; (switch-to-buffer (url-retrieve-synchronously "http://google.com")) + (setq ilookup-default "ja") (defun ilookup--timer-add () @@ -2500,10 +2517,10 @@ This function insert newline if required." inputl) (car inputl)))) (save-excursion + (setq ilookup--last-input input) (goto-char outpoint) (delete-region (point) (point-max)) - (setq ilookup--last-input input) (insert (if func (funcall func word)