
hunspell
Ubuntu 13.04-boxでドイツ語辞書でemacs24を使用したいです。
そのために、以下をインストールしてhunspell
ファイルhunspell-de
に追加しました.emacs
。
(setq ispell-program-name "hunspell")
(setq ispell-dictionary "deutsch8")
Emacsでファイルを開いて起動すると、flyspell-buffer
このメッセージが表示されますが、Starting new Ispell process [[hunspell::deutsch8]]
Emacsバッファをブロックし(マウスが待機を示すロータリーディスクに変わります)、何も表示せずに無限に動作します。それでは、私の構成に何か問題があるのは間違いありません。
2行目なしで動作しますが、英語のテキストにのみ適用されます。
hunspell
それでは、Ubuntu 13.04でemacs24
ドイツ語辞書を設定する最良の方法は何ですか?可能なトラップはありますか?
答え1
Emacs 24.4以降、ispellパッケージはHunspellとその辞書をすぐにサポートします。したがって、initファイルに次の2行を追加すると、Hunspellをデフォルトのスペルチェッカーに設定し、ドイツ語をデフォルトのスペルチェック言語に設定するのに十分です。
(setq ispell-program-name "hunspell"
ispell-dictionary "de_DE")
24.4以前のEmacsバージョンの場合は、次の手順に進みます。
辞書がパスにリストされていることを確認するには、hunspell -D
次のように出力する必要があります。
...
/usr/share/hunspell/en_US
/usr/share/hunspell/de_BE
/usr/share/hunspell/de_LU
/usr/share/hunspell/de_DE
...
次に、お気に入りの辞書をファイルに追加しますispell-local-dictionary-alist
。.emacs
(add-to-list 'ispell-local-dictionary-alist '("deutsch-hunspell"
"[[:alpha:]]"
"[^[:alpha:]]"
"[']"
t
("-d" "de_DE"); Dictionary file name
nil
iso-8859-1))
(add-to-list 'ispell-local-dictionary-alist '("english-hunspell"
"[[:alpha:]]"
"[^[:alpha:]]"
"[']"
t
("-d" "en_US")
nil
iso-8859-1))
(setq ispell-program-name "hunspell" ; Use hunspell to correct mistakes
ispell-dictionary "deutsch-hunspell") ; Default dictionary to use
これに加えて、ドイツ語と英語の辞書を切り替えてそれらをバインドする機能を定義することもできますC-c d
。
(defun switch-dictionary-de-en ()
"Switch german and english dictionaries."
(interactive)
(let* ((dict ispell-current-dictionary)
(new (if (string= dict "deutsch-hunspell") "english-hunspell"
"deutsch-hunspell")))
(ispell-change-dictionary new)
(message "Switched dictionary from %s to %s" dict new)))
(global-set-key (kbd "C-c d") 'switch-dictionary-de-en)
答え2
~からhttps://passingcuriosity.com/2017/emacs-hunspell-and-dictionaries/
次へ追加
;; Set $DICPATH to "$HOME/Library/Spelling" for hunspell. (setenv "DICPATH" "/path/to/hunspell/dictionary") ;; Tell ispell-mode to use hunspell. (setq ispell-program-name "hunspell")
あなたの
~/.emacs
。
私の辞書ファイルはにあります/usr/share/hunspell
。