[Top][All Lists]

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

Re: Getting Hunspell working properly in Linux

From: Rasmus
Subject: Re: Getting Hunspell working properly in Linux
Date: Sat, 03 Sep 2011 22:01:25 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

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)

 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"))
                          . wcheck-parse-suggestions-ispell))
                         (program . "/usr/bin/enchant")
                         (args . ("-l" "-d" "da_DK"))
                         (suggestion-program . "/usr/bin/hunspell")
                         (suggestion-args . ( "-t" "-m" "-a" "-d" "da_DK" "-i" 
                          . wcheck-parse-suggestions-ispell))
                         (program . "/usr/bin/enchant")
                         (args . ("-l" "-d" "da_DK"))
                         (suggestion-program . "/usr/bin/hunspell")
                         (suggestion-args . ( "-t" "-m" "-a" "-d" "de_DE" "-i" 
                          . wcheck-parse-suggestions-ispell))

;; toggle between Danish and English easily

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

(defun wcheck-set-english ()
  "switch ispell language to English"
  (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"
  (if (eq toggle-wcheck-english-danish t)
;       (set (make-local-variable 'foo) "value")
        (set (make-local-variable 'toggle-wcheck-english-danish) nil)
        (message "wcheck set to Danish"))
      (set (make-local-variable 'toggle-wcheck-english-danish) t)
      (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)


Sent from my Emacs

reply via email to

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