skk on emacs on ubuntu on WSL2

Windows 10上のWSL2のemacsでskk環境を設定したのでメモ。

WSL2上のUbuntuのシェルで以下のコマンド。

$ sudo apt install emacs

さくっとemacsのセットアップが終了。一旦emacsを起動しておく。

GUIがWindows上に出て楽しい。

(when (require 'package nil t)
  (add-to-list 'package-archives
	       '("melpa" . "https://melpa.org/packages/"))
  (add-to-list 'package-archives
	       '("melpa-stable" . "https://stable.melpa.org/packages/"))
  (package-initialize))

上の内容で~/.emacs.d/init.elを作成。emacsを再起動するか、init.elを再評価。これで、emacsのパッケージマネージャー(?) MELPAが使えるようになる。

M-x package-refresh-contents

でパッケージのリフレッシュ。

M-x package-install

の後、ddskkと入力することで、ddskkがインストールされる。

M-x skk-get

で、保存先を聞かれて、辞書がインストールされる。

(when (require 'package nil t)
  (add-to-list 'package-archives
	       '("melpa" . "https://melpa.org/packages/"))
  (add-to-list 'package-archives
	       '("melpa-stable" . "https://stable.melpa.org/packages/"))
  (package-initialize))

(when (require 'skk nil t)
  (global-set-key (kbd "C-x C-j") 'skk-mode)
  (global-set-key (kbd "C-x j") 'skk-auto-fill-mode)
  (setq default-input-method "japanese-skk")
  (require 'skk-study))
(add-hook 'isearch-mode-hook 'skk-isearch-mode-setup)
(add-hook 'isearch-mode-end-hook 'skk-isearch-mode-cleanup)

(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(package-selected-packages '(ddskk)))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 )

再び、~/.emacs.d/init.elを開いて、太字の部分を追加。emacsを再起動またはinit.elを再評価すれば、skkが使える。

最近は、Visual Studio Codeを使うことが多いし、日本語打つことが少ないから、skk on emacsの出番は少ないけど、あっと思ったときに必要なんだよね。

WindowsはCorvusSKKにしてあるし。

参考文献

https://qiita.com/tani_qiita/items/c5c7115e0ac3f8273664

https://www.math.s.chiba-u.ac.jp/~matsu/emacs/emacs27win/emacs-win.html

コメントを残す

このサイトはスパムを低減するために Akismet を使っています。コメントデータの処理方法の詳細はこちらをご覧ください