hunspell을 emacs 및 german과 함께 사용하기

hunspell을 emacs 및 german과 함께 사용하기

hunspell우분투 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 버퍼를 차단하고(마우스가 대기를 나타내는 회전 디스크로 변함) 아무 결과도 표시하지 않고 무한히 작동합니다. 그럼 내 구성에 뭔가 문제가 있는 게 틀림없어요.

두 번째 줄 없이 작동하지만 영어 텍스트에만 해당됩니다.

hunspell그렇다면 우분투 13.04에서 emacs24독일어 사전을 설정하는 가장 좋은 방법은 무엇입니까 ? 가능한 함정이 있나요?

답변1

Emacs 24.4부터 ispell 패키지는 Hunspell과 해당 사전을 즉시 지원합니다. 따라서 init 파일에 다음 두 줄을 추가하면 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.

관련 정보