help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting Hunspell working properly in Linux


From: Jeffrey Spencer
Subject: Re: Getting Hunspell working properly in Linux
Date: Sun, 04 Sep 2011 13:39:02 +1000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:5.0) Gecko/20110628 Thunderbird/5.0

Updated to the newest emacs 23.3 from 23.1 and seems hunspell is working just fine. I may try getting wcheck going later but now I only need the english US dictionary.

Cheers for the recommendation though.

On 09/04/2011 06:01 AM, Rasmus wrote:
I use wcheck

** Spelling (Wcheck)
    This will load wcheck using hunspell and add global hotkey. Default
    language is english

#+begin_src emacs-lisp

(setq ispell-really-hunspell t)

;; Wcheck
(autoload 'wcheck-mode "wcheck-mode"  "Toggle wcheck-mode." t)
(autoload 'wcheck-change-language "wcheck-mode"   "Switch wcheck-mode 
languages." t)
(autoload 'wcheck-spelling-suggestions "wcheck-mode"  "Spelling suggestions." t)
(setq  wcheck-timer-idle .1)


(setq-default
  wcheck-language "English"
  wcheck-language-data '(("English"
                         (program . "/usr/bin/enchant")
                         (args . ("-l" "-t" "-d" "en"))
                         (suggestion-program . "/usr/bin/enchant")
                         (suggestion-args . ("-a" "-d" "en_US"))
                         (suggestion-parser
                          . wcheck-parse-suggestions-ispell))
                        ("Danish"
                         (program . "/usr/bin/enchant")
                         (args . ("-l" "-d" "da_DK"))
                         (suggestion-program . "/usr/bin/hunspell")
                         (suggestion-args . ( "-t" "-m" "-a" "-d" "da_DK" "-i" 
"utf-8"))
                         (suggestion-parser
                          . wcheck-parse-suggestions-ispell))
                        ("German"
                         (program . "/usr/bin/enchant")
                         (args . ("-l" "-d" "da_DK"))
                         (suggestion-program . "/usr/bin/hunspell")
                         (suggestion-args . ( "-t" "-m" "-a" "-d" "de_DE" "-i" 
"utf-8"))
                         (suggestion-parser
                          . wcheck-parse-suggestions-ispell))
))


;; toggle between Danish and English easily

(defun wcheck-set-danish ()
   "switch wcheck language to English"
   (interactive)
   (wcheck-change-language "Danish"))

(defun wcheck-set-english ()
   "switch ispell language to English"
   (interactive)
   (wcheck-change-language "English"))

(defvar toggle-wcheck-english-danish t
   "state of english/danish toggle. nil means English, t means Danish")

(make-variable-buffer-local 'toggle-ispell-english-danish)

(defun wcheck-toggle-language ()
   "Toggle ispell-language between English and Danish"
   (interactive)
   (if (eq toggle-wcheck-english-danish t)
       (progn
;       (set (make-local-variable 'foo) "value")
        (set (make-local-variable 'toggle-wcheck-english-danish) nil)
        (wcheck-set-danish)
        (message "wcheck set to Danish"))
     (progn
       (set (make-local-variable 'toggle-wcheck-english-danish) t)
       (wcheck-set-english)
       (message "wcheck set to English"))))

;; keys
(define-key global-map [f5] 'wcheck-mode)
(define-key global-map [S-f5] 'wcheck-toggle-language)


(global-set-key "\M-n" 'wcheck-spelling-suggestions)
#+end_src

–Rasmus




reply via email to

[Prev in Thread] Current Thread [Next in Thread]