「emacs-mozc を動かすための設定(サーバ準備編)」の編集履歴(バックアップ)一覧はこちら
追加された行は緑色になります。
削除された行は赤色になります。
&bold(){■ Windows版 Emacs 共通の設定}
----
&bold(){【お知らせ】}
----
&bold(){<2018/07/17 追記>}
Vagrant を WSL から利用する場合は次のページを参考としてください。本ページの内容は Cygwin を利用する場合の説明となっています。
・https://www.vagrantup.com/docs/other/wsl.html
&bold(){<2014/11/18 追記>}
Windows で Google日本語入力 と連携可能な mozc_emacs_helper.exe を作成することに成功しました。mozc_emacs_helper.exe を使えばここのページの設定は不要となります。mozc_emacs_helper.exe を利用する場合は、次のページを参照ください。
・「[[emacs-mozc を動かすための設定(mozc_emacs_helper コンパイル編)]]」
&bold(){<2014/11/10 追記>}
次のサイトで、W32-IME対応の emacs-24.4-IME-patched-generic-cpu.zip が公開されています。x64 OS を利用の場合はこちらの利用も検討ください。
・https://github.com/chuntaro/NTEmacs64
x86 OS 利用の場合は、x86版の Emacs-24.4 を次のページからダウンロードできます。こちらは W32-IME対応版 ではありませんので、emacs-mozc の利用をお勧めします。
・http://ftp.gnu.org/gnu/emacs/windows/
・http://sourceforge.net/projects/emacs-bin/files/releases/
&bold(){【本題】}
----
・関連して、「[[emacs-mozc を動かすための設定(Emacs 設定編)]]」も参照ください。
NTEmacs で emacs-mozc を動かすためのサーバ準備編です。
Emacs で emacs-mozc を動かすためには、mozc-server や mozc-emacs-helper が必要です。これを Linux の環境上に構築します。
既にネットワーク上や仮想マシン上に linux 環境を持っている方は、その環境に次のパッケージをインストールしてください。
・emacs-mozc-bin
・mozc-utils-gui
また、「[[ssh-agent や ssh-pageant を使って、ssh のパスフレーズの入力を省略するための設定(方法3)]]」等を参考として、NTEEmacs の shell等 からサーバにパスワード、パスフレーズを入力することなく sshログイン できるようにしてください。
linux の環境を持っていない場合は、次のサイトを参考として、Vagrant(+VrtualBox)で linux server を立ち上げてください。
https://github.com/igjit/vagrant-emacs-mozc(igjit様、利用させていただきます。)
環境構築の大まかな流れは以下のとおりとなります。
1) Vagrang と VrtualBox をインストールする。
2) インストールした Vagrant が Cygwin から実行できるように、Vagrant のインストールディレクトリの binディレクトリ に PATH を通す。
3) Windows と Cygwinホームディレクトリ が異なる場合は、管理者権限でコマンドプロンプトを起動し、次のコマンドを実行する。
(パスは適宜変更してください。また、Unix とは引数の順が逆ですので注意してください。)
> cd C:\Windows\system32
> mklink C:\gnupack\home\.vagrant.d C:\Users\<user>\.vagrant.d
> mklink C:\gnupack\home\.VirtualBox C:\Users\<user>\.VirtualBox
> mklink "C:\gnupack\home\VirtualBox VMs" "C:\Users\<user>\VirtualBox VMs"
4) Proxyサーバ を介してインターネットに接続している場合は、Cygwin に次の設定を行う。(ホストOS側のための設定)
(gnupack の shell から Cygwin 環境を使う場合は、config.ini で設定するのが良いと思います。)
(<IP address> と <port> の部分は、適宜変更してください。)
export http_proxy="http://<IP address>:<port>/"
export https_proxy="http://<IP address>:<port>/"
export no_proxy="localhost,127.0.0.1"
5) Cygwin で次のコマンドを実行する。
(Cygwin に git がインストールされていなければ、setup-x86.exe 等を使ってインストールしてください。)
$ git clone https://github.com/igjit/vagrant-emacs-mozc.git
$ cd vagrant-emacs-mozc/
6) Vagrantfile を開き、次の2つの変数を変更して i386版OS を使うようにする。
(設定を変更せずに amd64版OS を使う場合は、BIOS設定 で VT-x/AMD-V が有効となっていることを確認してください。)
config.vm.box = "trusty-server-cloudimg-i386"
config.vm.box_url = "https://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-i386-vagrant-disk1.box"
7) Proxyサーバ を介してインターネットに接続している場合は、Cygwin で次のコマンドを実行する。(ゲストOS側のための設定)
$ vagrant plugin install vagrant-proxyconf
また、Vagrantfile の最終行の end の前に次の行を追加する。(<IP address> と <port> の部分は、適宜変更してください。)
if Vagrant.has_plugin?("vagrant-proxyconf")
config.proxy.http = "http://<IP address>:<port>/"
config.proxy.https = "http://<IP address>:<port>/"
config.proxy.no_proxy = "localhost,127.0.0.1"
end
8) Cygwin で次のコマンドを実行する。
$ vagrant up
9) 次のコマンドを実行し、サーバにログインできることを確認する。
$ ssh -p 2422 -i ~/.vagrant.d/insecure_private_key vagrant@127.0.0.1
このページの設定を何度か繰り返した場合などに、次のエラーが出る場合があります。
その場合は、~/.ssh/known_hosts を削除してみてください。
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
10) 次のコマンドを実行し、リモートの mozc_emacs_helper が動作することを確認する。
$ echo -e '(0 CreateSession)\n(1 SendKey 1 97)' | ./mozc_emacs_helper.sh
((mozc-emacs-helper . t)(version . "1.13.1651.102")(config . ((preedit-method . roman))))
((emacs-event-id . 0)(emacs-session-id . 1)(output . ()))
((emacs-event-id . 1)(emacs-session-id . 1)(output . ((id . "2112461956057362500")(mode . hiragana)(consumed . t)(preedit . ((cursor . 1)(segment ((annotation . underline)(value . "あ")(value-length . 1)(key . "あ")))))(candidates . ((size . 1)(candidate ((index . 0)(value . "あ")(annotation . ((description . "ひらがな")))(id . 0)))(position . 0)(category . suggestion)(display-type . main)(footer . ((label . "Tabキーで選択")))))(status . ((activated . t)(mode . hiragana)(comeback-mode . hiragana)))(all-candidate-words . ((candidates ((id . 0)(index . 0)(value . "あ")(annotation . ((description . "ひらがな")))))(category . suggestion))))))
以上でうまく行かない場合は、次のページも参照して問題を解決してください。
・Vagrant で立ち上げたサーバに接続できないときは..
http://sakashushu.blog.so-net.ne.jp/2014-06-16
・Cygwin から Vagrant を使うには..
http://futurismo.biz/archives/1651
・Proxy 経由でインターネットに接続している場合は..
http://weblabo.oscasierra.net/vagrant-proxyconf/
また、PC をシャットダウンする際は、事前に vagrant-emacs-mozc ディレクトリ配下で次のコマンドを入力し、サーバを停止してください。
vagrant halt
11) つづいて、「[[emacs-mozc を動かすための設定(Emacs 設定編)]]」の設定を行う。
----
<変更履歴>
・2014/10/30 このページを作成した。
----
#javascript(){{
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-40267130-1', 'atwiki.jp');
ga('send', 'pageview');
</script>
}}
&bold(){■ Windows版 Emacs 共通の設定}
----
&bold(){【お知らせ】}
----
&bold(){<2018/07/17 追記>}
Vagrant を WSL から利用する場合は次のページを参考としてください。本ページの内容は Cygwin を利用する場合の説明となっています。
・https://www.vagrantup.com/docs/other/wsl.html
&bold(){<2014/11/18 追記>}
Windows で Google日本語入力 と連携可能な mozc_emacs_helper.exe を作成することに成功しました。mozc_emacs_helper.exe を使えばここのページの設定は不要となります。mozc_emacs_helper.exe を利用する場合は、次のページを参照ください。
・「[[emacs-mozc を動かすための設定(mozc_emacs_helper コンパイル編)]]」
&bold(){<2014/11/10 追記>}
次のリポジトリで、W32-IME対応の emacs-24.4-IME-patched-generic-cpu.zip が公開されています。x64 OS を利用の場合はこちらの利用も検討ください。
・https://github.com/chuntaro/NTEmacs64
x86 OS 利用の場合は、x86版の Emacs-24.4 を次のページからダウンロードできます。こちらは W32-IME対応版 ではありませんので、emacs-mozc の利用をお勧めします。
・http://ftp.gnu.org/gnu/emacs/windows/
・http://sourceforge.net/projects/emacs-bin/files/releases/
&bold(){【本題】}
----
・関連して、「[[emacs-mozc を動かすための設定(Emacs 設定編)]]」も参照ください。
NTEmacs で emacs-mozc を動かすためのサーバ準備編です。
Emacs で emacs-mozc を動かすためには、mozc-server や mozc-emacs-helper が必要です。これを Linux の環境上に構築します。
既にネットワーク上や仮想マシン上に linux 環境を持っている方は、その環境に次のパッケージをインストールしてください。
・emacs-mozc-bin
・mozc-utils-gui
また、「[[ssh-agent や ssh-pageant を使って、ssh のパスフレーズの入力を省略するための設定(方法3)]]」等を参考として、NTEEmacs の shell等 からサーバにパスワード、パスフレーズを入力することなく sshログイン できるようにしてください。
linux の環境を持っていない場合は、次のサイトを参考として、Vagrant(+VrtualBox)で linux server を立ち上げてください。
https://github.com/igjit/vagrant-emacs-mozc(igjit様、利用させていただきます。)
環境構築の大まかな流れは以下のとおりとなります。
1) Vagrang と VrtualBox をインストールする。
2) インストールした Vagrant が Cygwin から実行できるように、Vagrant のインストールディレクトリの binディレクトリ に PATH を通す。
3) Windows と Cygwinホームディレクトリ が異なる場合は、管理者権限でコマンドプロンプトを起動し、次のコマンドを実行する。
(パスは適宜変更してください。また、Unix とは引数の順が逆ですので注意してください。)
> cd C:\Windows\system32
> mklink C:\gnupack\home\.vagrant.d C:\Users\<user>\.vagrant.d
> mklink C:\gnupack\home\.VirtualBox C:\Users\<user>\.VirtualBox
> mklink "C:\gnupack\home\VirtualBox VMs" "C:\Users\<user>\VirtualBox VMs"
4) Proxyサーバ を介してインターネットに接続している場合は、Cygwin に次の設定を行う。(ホストOS側のための設定)
(gnupack の shell から Cygwin 環境を使う場合は、config.ini で設定するのが良いと思います。)
(<IP address> と <port> の部分は、適宜変更してください。)
export http_proxy="http://<IP address>:<port>/"
export https_proxy="http://<IP address>:<port>/"
export no_proxy="localhost,127.0.0.1"
5) Cygwin で次のコマンドを実行する。
(Cygwin に git がインストールされていなければ、setup-x86.exe 等を使ってインストールしてください。)
$ git clone https://github.com/igjit/vagrant-emacs-mozc.git
$ cd vagrant-emacs-mozc/
6) Vagrantfile を開き、次の2つの変数を変更して i386版OS を使うようにする。
(設定を変更せずに amd64版OS を使う場合は、BIOS設定 で VT-x/AMD-V が有効となっていることを確認してください。)
config.vm.box = "trusty-server-cloudimg-i386"
config.vm.box_url = "https://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-i386-vagrant-disk1.box"
7) Proxyサーバ を介してインターネットに接続している場合は、Cygwin で次のコマンドを実行する。(ゲストOS側のための設定)
$ vagrant plugin install vagrant-proxyconf
また、Vagrantfile の最終行の end の前に次の行を追加する。(<IP address> と <port> の部分は、適宜変更してください。)
if Vagrant.has_plugin?("vagrant-proxyconf")
config.proxy.http = "http://<IP address>:<port>/"
config.proxy.https = "http://<IP address>:<port>/"
config.proxy.no_proxy = "localhost,127.0.0.1"
end
8) Cygwin で次のコマンドを実行する。
$ vagrant up
9) 次のコマンドを実行し、サーバにログインできることを確認する。
$ ssh -p 2422 -i ~/.vagrant.d/insecure_private_key vagrant@127.0.0.1
このページの設定を何度か繰り返した場合などに、次のエラーが出る場合があります。
その場合は、~/.ssh/known_hosts を削除してみてください。
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
10) 次のコマンドを実行し、リモートの mozc_emacs_helper が動作することを確認する。
$ echo -e '(0 CreateSession)\n(1 SendKey 1 97)' | ./mozc_emacs_helper.sh
((mozc-emacs-helper . t)(version . "1.13.1651.102")(config . ((preedit-method . roman))))
((emacs-event-id . 0)(emacs-session-id . 1)(output . ()))
((emacs-event-id . 1)(emacs-session-id . 1)(output . ((id . "2112461956057362500")(mode . hiragana)(consumed . t)(preedit . ((cursor . 1)(segment ((annotation . underline)(value . "あ")(value-length . 1)(key . "あ")))))(candidates . ((size . 1)(candidate ((index . 0)(value . "あ")(annotation . ((description . "ひらがな")))(id . 0)))(position . 0)(category . suggestion)(display-type . main)(footer . ((label . "Tabキーで選択")))))(status . ((activated . t)(mode . hiragana)(comeback-mode . hiragana)))(all-candidate-words . ((candidates ((id . 0)(index . 0)(value . "あ")(annotation . ((description . "ひらがな")))))(category . suggestion))))))
以上でうまく行かない場合は、次のページも参照して問題を解決してください。
・Vagrant で立ち上げたサーバに接続できないときは..
http://sakashushu.blog.so-net.ne.jp/2014-06-16
・Cygwin から Vagrant を使うには..
http://futurismo.biz/archives/1651
・Proxy 経由でインターネットに接続している場合は..
http://weblabo.oscasierra.net/vagrant-proxyconf/
また、PC をシャットダウンする際は、事前に vagrant-emacs-mozc ディレクトリ配下で次のコマンドを入力し、サーバを停止してください。
vagrant halt
11) つづいて、「[[emacs-mozc を動かすための設定(Emacs 設定編)]]」の設定を行う。
----
<変更履歴>
・2014/10/30 このページを作成した。
----
#javascript(){{
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-40267130-1', 'atwiki.jp');
ga('send', 'pageview');
</script>
}}