all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Getting Hunspell working properly in Linux
@ 2011-09-03 17:10 Jeffrey Spencer
  2011-09-03 20:01 ` Rasmus
  0 siblings, 1 reply; 6+ messages in thread
From: Jeffrey Spencer @ 2011-09-03 17:10 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 1804 bytes --]

I have been trying to get hunspell working for nearly two days and can't 
seem to figure it out. I have followed and tried everything I could 
find. Everything on http://www.emacswiki.org/emacs/InteractiveSpell and 
elsewhere. I think it is an issue with not recognizing the dictionaries 
properly. They might be in the wrong encoding format or it isn't 
checking in the right folder. Any help on this would be appreciated or 
directions to take. I've tried the below and many variations of them and 
can't seem to get anything to work. I think it has to do with the 
dictionary list possibly.

|;; Use hunspell instead of ispell
(setq ispell-program-name "hunspell")
(require 'rw-language-and-country-codes)
(require 'rw-ispell)
(require 'rw-hunspell)
(setq ispell-dictionary "en_US")
;; The following is set via custom
(custom-set-variables
  '(rw-hunspell-dicpath-list (quote ("/usr/share/hunspell")))
  '(rw-hunspell-make-dictionary-menu t)
  '(rw-hunspell-use-rw-ispell t)
)
|

or

|(eval-after-load "ispell"
    (progn
      (setq ispell-dictionary "en_US"
            ispell-extra-args '("-a" "-i" "utf-8")
            ispell-silently-savep t
            ispell-dictionary-alist
            '((nil ; default
               "[A-Za-z]" "[^A-Za-z]" "[']" t ("-d" "en_US" "-i"
"utf-8") nil utf-8)
              ("american" ; Yankee English
               "[A-Za-z]" "[^A-Za-z]" "[']" t ("-d" "en_US" "-i"
"utf-8") nil utf-8)
              ("british" ; British English
               "[A-Za-z]" "[^A-Za-z]" "[']" t ("-d" "en_GB" "-i"
"utf-8") nil utf-8)
              )))
(setq-default ispell-program-name "hunspell")
|

so now I just have:

|(setq ispell-program-name "hunspell")
     (setq ispell-silently-savep t)|

cheers,
Jeff

-- 
________________________
Jeffrey Spencer
jeffspencerd@gmail.com


[-- Attachment #2: Type: text/html, Size: 9355 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Getting Hunspell working properly in Linux
  2011-09-03 17:10 Getting Hunspell working properly in Linux Jeffrey Spencer
@ 2011-09-03 20:01 ` Rasmus
  2011-09-04  3:39   ` Jeffrey Spencer
  2011-09-10 14:47   ` Teemu Likonen
  0 siblings, 2 replies; 6+ messages in thread
From: Rasmus @ 2011-09-03 20:01 UTC (permalink / raw)
  To: help-gnu-emacs


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




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Getting Hunspell working properly in Linux
  2011-09-03 20:01 ` Rasmus
@ 2011-09-04  3:39   ` Jeffrey Spencer
  2011-09-10 14:47   ` Teemu Likonen
  1 sibling, 0 replies; 6+ messages in thread
From: Jeffrey Spencer @ 2011-09-04  3:39 UTC (permalink / raw)
  To: Rasmus; +Cc: help-gnu-emacs

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
>



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Getting Hunspell working properly in Linux
  2011-09-03 20:01 ` Rasmus
  2011-09-04  3:39   ` Jeffrey Spencer
@ 2011-09-10 14:47   ` Teemu Likonen
  2011-09-10 23:36     ` Rasmus
  1 sibling, 1 reply; 6+ messages in thread
From: Teemu Likonen @ 2011-09-10 14:47 UTC (permalink / raw)
  To: rasmus; +Cc: help-gnu-emacs

* 2011-09-03T22:01:25+02:00 * <rasmus@gmx.us> wrote:

> I use wcheck 

Me too.

> (global-set-key "\M-n" 'wcheck-spelling-suggestions)

I see that you are using an old version of wcheck-mode. There's nothing
wrong with that. I'll just point out that the version released a couple
of months ago has more versatile wcheck-actions feature that supersedes
wcheck-spelling-suggestions. Any kind of actions can be programmed for
marked text, not just spelling suggestions. Configuring for Ispell-like
spelling suggestions is still pretty much the same.

http://www.emacswiki.org/emacs/WcheckMode



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Getting Hunspell working properly in Linux
  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
  0 siblings, 1 reply; 6+ messages in thread
From: Rasmus @ 2011-09-10 23:36 UTC (permalink / raw)
  To: help-gnu-emacs


Hi Teemu,

>> I use wcheck
>
> Me too.

I would have taken you for a hardcore ispell.el'er :)

> I see that you are using an old version of wcheck-mode. There's nothing
> wrong with that. I'll just point out that the version released a couple
> of months ago has more versatile wcheck-actions feature that supersedes
> wcheck-spelling-suggestions. Any kind of actions can be programmed for
> marked text, not just spelling suggestions. Configuring for Ispell-like
> spelling suggestions is still pretty much the same.

Thanks for pointing out the new wcheck version.  I'd totally missed it.

I have been playing a little bit with wcheck, and I have a question. Is
it possible to combine dictionaries?  For example combining a whitespace
dictionary with a human language dictionary?

I have been trying to mix up an English+ dictionary which would not only
offer spelling suggestions, but also highlight lack of double-space
after periods etc.  If two dictionaries can be activated simultaneously
it would probably be easy to combine a regexp dictionary and an enchant
dictionary, but this does not seem possible.  From
wcheck-language-data-defaults it also seems that the regexp fields are
used for other stuff by default.  Do you have any good ideas on how to
archive this?

Thanks for wcheck!

–Rasmus

--
Sent from my Emacs










^ permalink raw reply	[flat|nested] 6+ messages in thread

* wcheck-mode (was: Getting Hunspell working properly in Linux)
  2011-09-10 23:36     ` Rasmus
@ 2011-09-11  6:49       ` Teemu Likonen
  0 siblings, 0 replies; 6+ messages in thread
From: Teemu Likonen @ 2011-09-11  6:49 UTC (permalink / raw)
  To: rasmus; +Cc: help-gnu-emacs

* 2011-09-11T01:36:13+02:00 * <rasmus@gmx.us> wrote:

> I have been playing a little bit with wcheck, and I have a question.
> Is it possible to combine dictionaries? For example combining a
> whitespace dictionary with a human language dictionary?

Not possible, sorry. In my head I've been designing a nice support for
multiple simultaneous wcheck languages but it's not completely trivial.
I still believe it's possible with reasonable efforts, though. I haven't
written any actual code experiments to that direction yet but someday I
may.

Mixing two (or more) external checker programs is simple. For example,
if one wants to accept all words written either in Finnish or English
one could use a shell script as the spelling checker:

    #!/bin/sh
    enchant -l -d fi | enchant -l -d en_GB

I think language option connection=pty is required with shell scripts.

> From wcheck-language-data-defaults it also seems that the regexp
> fields are used for other stuff by default.

Options in wcheck-language-data-defaults are used when a
language-specific option does not exist or has an invalid value. That's
all.

> Thanks for wcheck!

Thank you. It's nice to know that you find it useful.



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-09-11  6:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-03 17:10 Getting Hunspell working properly in Linux Jeffrey Spencer
2011-09-03 20:01 ` Rasmus
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

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.