Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Google日本語変換API #16

Open
naota opened this issue Jan 26, 2022 · 0 comments
Open

Support Google日本語変換API #16

naota opened this issue Jan 26, 2022 · 0 comments

Comments

@naota
Copy link

naota commented Jan 26, 2022

以下のSKKのGoogle日本語変換APIを使った変換のように、辞書にないものを変換できるようになると嬉しい。

(defun skk-google-japanese-mode (arg)
  "Convert かな to 漢字 using Google API.
See Info node `(skk) Google CGI API for Japanese Input を利用したかな漢字変換'.

With a prefix argument ARG, enable Google Japanese Input if ARG
is positive, and disable it otherwise."
  ;; https://www.google.co.jp/ime/cgiapi.html
  (interactive "p")
  ;; (require 'skk-search-web)
  (require 'dash)
  ;; (message "arg is %S" arg)
  (let ((prog-search '(skk-search-web 'skk-google-cgi-api-for-japanese-input))
        (prog-entry '(lambda () (car (skk-google-suggest skk-henkan-key))))
        ;; (prog-comp '(skk-comp-google))
        (is-interactive (called-interactively-p 'any)))
    (when (and is-interactive (equal arg 1))
      (setq arg (if (member prog-search skk-search-prog-list) -1 1)))
    (if (> arg 0)
        ;; turn on
        (progn (add-to-list 'skk-search-prog-list prog-search t)
               ;; (add-to-list 'skk-completion-prog-list prog-comp t)
               (setq skk-read-from-minibuffer-function prog-entry)
               (when is-interactive
                 (message "SKK Google Japanese mode enabled")))
      ;; turn off
      (setq skk-search-prog-list
            (-remove-item prog-search skk-search-prog-list))
      ;; (setq skk-completion-prog-list
      ;;       (-remove-item prog-comp skk-completion-prog-list))
      (custom-reevaluate-setting 'skk-read-from-minibuffer-function)
      (when is-interactive
        (message "SKK Google Japanese mode disabled")))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant