all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Rasmus <rasmus@gmx.us>
To: help-gnu-emacs@gnu.org
Subject: Re: Getting Hunspell working properly in Linux
Date: Sat, 03 Sep 2011 22:01:25 +0200	[thread overview]
Message-ID: <87obz1tmy2.fsf@gmail.com> (raw)
In-Reply-To: 4E625F6A.3000307@gmail.com


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

-- 
Sent from my Emacs




  reply	other threads:[~2011-09-03 20:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-03 17:10 Getting Hunspell working properly in Linux Jeffrey Spencer
2011-09-03 20:01 ` Rasmus [this message]
2011-09-04  3:39   ` Jeffrey Spencer
2011-09-10 14:47   ` Teemu Likonen
2011-09-10 23:36     ` Rasmus
2011-09-11  6:49       ` wcheck-mode (was: Getting Hunspell working properly in Linux) Teemu Likonen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87obz1tmy2.fsf@gmail.com \
    --to=rasmus@gmx.us \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.