GNU bug report logs - #13460
Issue to change dictionary when using hunspell on emacs

Previous Next

Package: emacs;

Reported by: Jochen Schmitt <Jochen <at> herr-schmitt.de>

Date: Wed, 16 Jan 2013 16:37:02 UTC

Severity: normal

Done: Agustin Martin <agustin.martin <at> hispalinux.es>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 13460 in the body.
You can then email your comments to 13460 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#13460; Package emacs. (Wed, 16 Jan 2013 16:37:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Jochen Schmitt <Jochen <at> herr-schmitt.de>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 16 Jan 2013 16:37:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Jochen Schmitt <Jochen <at> herr-schmitt.de>
To: bug-gnu-emacs <at> gnu.org
Subject: Issue to change dictionary when using hunspell on emacs
Date: Wed, 16 Jan 2013 13:25:10 +0100
Hallo,

I'm using emacs-24.1 on Fedora 17 (x86_64) and have the following
isuue. When I want to write an text in enlish I have to change
the used dictionary with M-x ispell-change-disctionary english.

Unfortunately, I have to find out, that hunspell doesn't works
properly after I have changed the dictionary to english.

My examination show, that emacs will called hunspell in the way
quoted abouve:

[s4504kr <at> omega ~]$ hunspell -a  -d english -B -i iso-8859-1
@(#) International Ispell Version 3.2.06 (but really Hunspell 1.3.2)
Can't open affix or dictionary files for dictionary named "english".
[s4504kr <at> omega ~]$ exit
exit

So It may be nice, if you have an solution for this issue.

Best Regards:

Jochen Schmitt




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13460; Package emacs. (Wed, 16 Jan 2013 18:03:02 GMT) Full text and rfc822 format available.

Message #8 received at 13460 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Jochen Schmitt <Jochen <at> herr-schmitt.de>
Cc: 13460 <at> debbugs.gnu.org
Subject: Re: bug#13460: Issue to change dictionary when using hunspell on emacs
Date: Wed, 16 Jan 2013 20:01:53 +0200
> Date: Wed, 16 Jan 2013 13:25:10 +0100
> From: Jochen Schmitt <Jochen <at> herr-schmitt.de>
> 
> I'm using emacs-24.1 on Fedora 17 (x86_64) and have the following
> isuue. When I want to write an text in enlish I have to change
> the used dictionary with M-x ispell-change-disctionary english.
> 
> Unfortunately, I have to find out, that hunspell doesn't works
> properly after I have changed the dictionary to english.
> 
> My examination show, that emacs will called hunspell in the way
> quoted abouve:
> 
> [s4504kr <at> omega ~]$ hunspell -a  -d english -B -i iso-8859-1
> @(#) International Ispell Version 3.2.06 (but really Hunspell 1.3.2)
> Can't open affix or dictionary files for dictionary named "english".
> [s4504kr <at> omega ~]$ exit
> exit
> 
> So It may be nice, if you have an solution for this issue.

You need to install the English dictionary for Hunspell.  I suspect
that its name will be en_US (or maybe en_GB), not "english".




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13460; Package emacs. (Wed, 16 Jan 2013 23:25:01 GMT) Full text and rfc822 format available.

Message #11 received at 13460 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 13460 <at> debbugs.gnu.org, Jochen Schmitt <Jochen <at> herr-schmitt.de>
Subject: Re: bug#13460: Issue to change dictionary when using hunspell on emacs
Date: Wed, 16 Jan 2013 18:23:23 -0500
Eli Zaretskii wrote:

> You need to install the English dictionary for Hunspell.  I suspect
> that its name will be en_US (or maybe en_GB), not "english".

M-x ispell-change-dictionary doesn't accept "en_US" as input.
It wants something like "english" (coming from
ispell-dictionary-base-alist), which as you say is wrong.
Tested with:

hunspell -D
[...]
LOADED DICTIONARY:
/usr/share/myspell/en_US.aff
/usr/share/myspell/en_US.dic
Hunspell 1.2.8

emacs -Q --eval '(setq ispell-program-name "/usr/bin/hunspell")





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13460; Package emacs. (Thu, 17 Jan 2013 03:52:01 GMT) Full text and rfc822 format available.

Message #14 received at 13460 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 13460 <at> debbugs.gnu.org, Jochen <at> herr-schmitt.de
Subject: Re: bug#13460: Issue to change dictionary when using hunspell on emacs
Date: Thu, 17 Jan 2013 05:51:13 +0200
> From: Glenn Morris <rgm <at> gnu.org>
> Cc: Jochen Schmitt <Jochen <at> herr-schmitt.de>,  13460 <at> debbugs.gnu.org
> Date: Wed, 16 Jan 2013 18:23:23 -0500
> 
> Eli Zaretskii wrote:
> 
> > You need to install the English dictionary for Hunspell.  I suspect
> > that its name will be en_US (or maybe en_GB), not "english".
> 
> M-x ispell-change-dictionary doesn't accept "en_US" as input.
> It wants something like "english" (coming from
> ispell-dictionary-base-alist), which as you say is wrong.

Then one needs to customize ispell-local-dictionary-alist to include
the setting for en_US.  Here's what I have there:

     '("en_US"
	"[[:alpha:]]"
	"[^[:alpha:]]"
	"[']" nil ("-r") nil utf-8)

The OP may wish to omit the -r switch, it's not a necessity.

Also, be sure to look at en_US.aff and match the character set it
mentions there with the "utf-8" part above.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13460; Package emacs. (Thu, 17 Jan 2013 06:39:02 GMT) Full text and rfc822 format available.

Message #17 received at 13460 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 13460 <at> debbugs.gnu.org, Jochen <at> herr-schmitt.de
Subject: Re: bug#13460: Issue to change dictionary when using hunspell on emacs
Date: Thu, 17 Jan 2013 01:37:30 -0500
Eli Zaretskii wrote:

>> From: Glenn Morris <rgm <at> gnu.org>
>> Cc: Jochen Schmitt <Jochen <at> herr-schmitt.de>,  13460 <at> debbugs.gnu.org
>> Date: Wed, 16 Jan 2013 18:23:23 -0500
>> 
>> Eli Zaretskii wrote:
>> 
>> > You need to install the English dictionary for Hunspell.  I suspect
>> > that its name will be en_US (or maybe en_GB), not "english".
>> 
>> M-x ispell-change-dictionary doesn't accept "en_US" as input.
>> It wants something like "english" (coming from
>> ispell-dictionary-base-alist), which as you say is wrong.
>
> Then one needs to customize ispell-local-dictionary-alist to include
> the setting for en_US.  Here's what I have there:
>
>      '("en_US"
> 	"[[:alpha:]]"
> 	"[^[:alpha:]]"
> 	"[']" nil ("-r") nil utf-8)
>
> The OP may wish to omit the -r switch, it's not a necessity.
>
> Also, be sure to look at en_US.aff and match the character set it
> mentions there with the "utf-8" part above.

IMO it should work out of the box.
Ie ispell-set-spellchecker-params should handle hunspell as it currently
does aspell, which has its own ispell-find-aspell-dictionaries func.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13460; Package emacs. (Thu, 17 Jan 2013 12:28:01 GMT) Full text and rfc822 format available.

Message #20 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Agustin Martin <agustin.martin <at> hispalinux.es>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#13460: Issue to change dictionary when using hunspell on emacs
Date: Thu, 17 Jan 2013 13:26:31 +0100
On Thu, Jan 17, 2013 at 01:37:30AM -0500, Glenn Morris wrote:
> Eli Zaretskii wrote:
> 
> >> From: Glenn Morris <rgm <at> gnu.org>
> >> Cc: Jochen Schmitt <Jochen <at> herr-schmitt.de>,  13460 <at> debbugs.gnu.org
> >> Date: Wed, 16 Jan 2013 18:23:23 -0500
> >> 
> >> Eli Zaretskii wrote:
> >> 
> >> > You need to install the English dictionary for Hunspell.  I suspect
> >> > that its name will be en_US (or maybe en_GB), not "english".
> >> 
> >> M-x ispell-change-dictionary doesn't accept "en_US" as input.
> >> It wants something like "english" (coming from
> >> ispell-dictionary-base-alist), which as you say is wrong.
> >
> > Then one needs to customize ispell-local-dictionary-alist to include
> > the setting for en_US.  Here's what I have there:
> >
> >      '("en_US"
> > 	"[[:alpha:]]"
> > 	"[^[:alpha:]]"
> > 	"[']" nil ("-r") nil utf-8)
> >
> > The OP may wish to omit the -r switch, it's not a necessity.
> >
> > Also, be sure to look at en_US.aff and match the character set it
> > mentions there with the "utf-8" part above.
> 
> IMO it should work out of the box.
> Ie ispell-set-spellchecker-params should handle hunspell as it currently
> does aspell, which has its own ispell-find-aspell-dictionaries func.

The problem is that hunspell -D does not return control. A bug has been
opened for this, together with patch suggested by Eli Zaretskii,

http://sourceforge.net/tracker/?func=detail&aid=3522524&group_id=143754&atid=756395

A workaround was proposed (redirecting from /dev/null), but it seems too
UNIX biassed.

There is also an associated problem when hunspell does not find the requested
dictionary under Emacs, because it does not triger an explicit error. This
leaves Emacs waiting for a reply in an infinite loop,

http://bugs.debian.org/690318

The reason is that when in pipe mode hunspell sends init string in a non
ispell/aspell compliant way. Reported and patch proposed as

http://sourceforge.net/tracker/?func=detail&aid=3577183&group_id=143754&atid=756395

-- 
Agustin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13460; Package emacs. (Thu, 17 Jan 2013 15:26:02 GMT) Full text and rfc822 format available.

Message #23 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Agustin Martin <agustin.martin <at> hispalinux.es>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#13460: Issue to change dictionary when using hunspell on emacs
Date: Thu, 17 Jan 2013 16:24:16 +0100
On Thu, Jan 17, 2013 at 01:26:31PM +0100, Agustin Martin wrote:
> On Thu, Jan 17, 2013 at 01:37:30AM -0500, Glenn Morris wrote:
> > Eli Zaretskii wrote:
> > 
> > >> From: Glenn Morris <rgm <at> gnu.org>
> > >> Cc: Jochen Schmitt <Jochen <at> herr-schmitt.de>,  13460 <at> debbugs.gnu.org
> > >> Date: Wed, 16 Jan 2013 18:23:23 -0500
> > >> 
> > >> Eli Zaretskii wrote:
> > >> 
> > >> > You need to install the English dictionary for Hunspell.  I suspect
> > >> > that its name will be en_US (or maybe en_GB), not "english".
> > >> 
> > >> M-x ispell-change-dictionary doesn't accept "en_US" as input.
> > >> It wants something like "english" (coming from
> > >> ispell-dictionary-base-alist), which as you say is wrong.
> > >
> > > Then one needs to customize ispell-local-dictionary-alist to include
> > > the setting for en_US.  Here's what I have there:
> > >
> > >      '("en_US"
> > > 	"[[:alpha:]]"
> > > 	"[^[:alpha:]]"
> > > 	"[']" nil ("-r") nil utf-8)
> > >
> > > The OP may wish to omit the -r switch, it's not a necessity.
> > >
> > > Also, be sure to look at en_US.aff and match the character set it
> > > mentions there with the "utf-8" part above.
> > 
> > IMO it should work out of the box.
> > Ie ispell-set-spellchecker-params should handle hunspell as it currently
> > does aspell, which has its own ispell-find-aspell-dictionaries func.
> 
> The problem is that hunspell -D does not return control. A bug has been
> opened for this, together with patch suggested by Eli Zaretskii,
> 
> http://sourceforge.net/tracker/?func=detail&aid=3522524&group_id=143754&atid=756395
> 
> A workaround was proposed (redirecting from /dev/null), but it seems too
> UNIX biassed.

There is a second issue I forgot, one needs to get info from the installed
.aff files, so all them must be completely opened to look for that info
(OTHERCHARS and friends) and I'd expect that to slow Emacs init a bit. Since
I did not try to write preliminary code for that parsing I cannot evaluate
that delay. Fortunately aspell used small .dat files for that purpose.

-- 
Agustin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13460; Package emacs. (Thu, 17 Jan 2013 16:12:01 GMT) Full text and rfc822 format available.

Message #26 received at 13460 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Agustin Martin <agustin.martin <at> hispalinux.es>
Cc: 13460 <at> debbugs.gnu.org
Subject: Re: bug#13460: Issue to change dictionary when using hunspell on emacs
Date: Thu, 17 Jan 2013 18:10:29 +0200
> Date: Thu, 17 Jan 2013 13:26:31 +0100
> From: Agustin Martin <agustin.martin <at> hispalinux.es>
> 
> > Ie ispell-set-spellchecker-params should handle hunspell as it currently
> > does aspell, which has its own ispell-find-aspell-dictionaries func.
> 
> The problem is that hunspell -D does not return control.

Right.  But perhaps ispell.el could kill hunspell once it has read the
list of dictionaries.

> A workaround was proposed (redirecting from /dev/null), but it seems too
> UNIX biassed.

We could use 'null-device', which is portable.

> There is also an associated problem when hunspell does not find the requested
> dictionary under Emacs, because it does not triger an explicit error.

Right, but we should always find the dictionary ;-)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13460; Package emacs. (Thu, 17 Jan 2013 16:32:01 GMT) Full text and rfc822 format available.

Message #29 received at 13460 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Agustin Martin <agustin.martin <at> hispalinux.es>
Cc: 13460 <at> debbugs.gnu.org
Subject: Re: bug#13460: Issue to change dictionary when using hunspell on emacs
Date: Thu, 17 Jan 2013 11:31:00 -0500
> There is a second issue I forgot, one needs to get info from the installed
> .aff files, so all them must be completely opened to look for that info
> (OTHERCHARS and friends) and I'd expect that to slow Emacs init a bit.

We don't have to do that just to get the list of languages: it can be
delayed to the moment a particular language is selected.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13460; Package emacs. (Thu, 17 Jan 2013 16:43:02 GMT) Full text and rfc822 format available.

Message #32 received at 13460 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Agustin Martin <agustin.martin <at> hispalinux.es>
Cc: 13460 <at> debbugs.gnu.org
Subject: Re: bug#13460: Issue to change dictionary when using hunspell on emacs
Date: Thu, 17 Jan 2013 18:41:20 +0200
> Date: Thu, 17 Jan 2013 16:24:16 +0100
> From: Agustin Martin <agustin.martin <at> hispalinux.es>
> 
> There is a second issue I forgot, one needs to get info from the installed
> .aff files, so all them must be completely opened to look for that info
> (OTHERCHARS and friends) and I'd expect that to slow Emacs init a bit.

You don't need OTHERCHARS, only the SET, to figure out the encoding in
which to talk to hunspell for each dictionary.  (OTHERCHARS cannot be
gleaned from the hunspell .aff files anyway, AFAIU.)

The other problem is with CASECHARS, but that is unavailable with
aspell as well, we are just guessing there.  We could guess the same
for hunspell.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13460; Package emacs. (Thu, 17 Jan 2013 18:10:02 GMT) Full text and rfc822 format available.

Message #35 received at 13460 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Agustin Martin <agustin.martin <at> hispalinux.es>
Cc: 13460 <at> debbugs.gnu.org
Subject: Re: bug#13460: Issue to change dictionary when using hunspell on emacs
Date: Thu, 17 Jan 2013 13:08:30 -0500
Agustin Martin wrote:

> The problem is that hunspell -D does not return control.
[...]
> A workaround was proposed (redirecting from /dev/null), but it seems too
> UNIX biassed.

"UNIX biased" -> "does not work on MS Windows" ?

If the equivalent of "hunspell < null-device" works on MS Windows,
that's one problem easily solved, no?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13460; Package emacs. (Thu, 17 Jan 2013 18:14:01 GMT) Full text and rfc822 format available.

Message #38 received at 13460 <at> debbugs.gnu.org (full text, mbox):

From: Agustin Martin <agustin.martin <at> hispalinux.es>
To: 13460 <at> debbugs.gnu.org
Subject: Re: bug#13460: Issue to change dictionary when using hunspell on emacs
Date: Thu, 17 Jan 2013 19:12:34 +0100
On Thu, Jan 17, 2013 at 06:41:20PM +0200, Eli Zaretskii wrote:
> > Date: Thu, 17 Jan 2013 16:24:16 +0100
> > From: Agustin Martin <agustin.martin <at> hispalinux.es>
> > 
> > There is a second issue I forgot, one needs to get info from the installed
> > .aff files, so all them must be completely opened to look for that info
> > (OTHERCHARS and friends) and I'd expect that to slow Emacs init a bit.
> 
> You don't need OTHERCHARS, only the SET, to figure out the encoding in
> which to talk to hunspell for each dictionary.  (OTHERCHARS cannot be
> gleaned from the hunspell .aff files anyway, AFAIU.)

Sorry, I should have written WORDCHARS.

> The other problem is with CASECHARS, but that is unavailable with
> aspell as well, we are just guessing there.  We could guess the same
> for hunspell.

Agreed.

-- 
Agustin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13460; Package emacs. (Thu, 17 Jan 2013 18:17:02 GMT) Full text and rfc822 format available.

Message #41 received at 13460 <at> debbugs.gnu.org (full text, mbox):

From: Agustin Martin <agustin.martin <at> hispalinux.es>
To: 13460 <at> debbugs.gnu.org
Subject: Re: bug#13460: Issue to change dictionary when using hunspell on emacs
Date: Thu, 17 Jan 2013 19:15:21 +0100
On Thu, Jan 17, 2013 at 11:31:00AM -0500, Stefan Monnier wrote:
> > There is a second issue I forgot, one needs to get info from the installed
> > .aff files, so all them must be completely opened to look for that info
> > (OTHERCHARS and friends) and I'd expect that to slow Emacs init a bit.
> 
> We don't have to do that just to get the list of languages: it can be
> delayed to the moment a particular language is selected.

Good point, thanks. And that info can even be cached. I like this.

-- 
Agustin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13460; Package emacs. (Thu, 17 Jan 2013 18:21:02 GMT) Full text and rfc822 format available.

Message #44 received at 13460 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Jochen Schmitt <Jochen <at> herr-schmitt.de>
Cc: 13460 <at> debbugs.gnu.org
Subject: Re: bug#13460: Issue to change dictionary when using hunspell on emacs
Date: Thu, 17 Jan 2013 13:19:34 -0500
(Please keep the debbugs address cc'd.
Resending your comments so that they are more visible.)

Date: Thu, 17 Jan 2013 14:17:34 +0100
From: Jochen Schmitt <Jochen <at> herr-schmitt.de>

I have try to create a suggestion for a general solution for
this issue in the next release of emacs.

I have attached a patch on this mail which introduced a alist to
translate the dictionary names like 'english' in the form which will
be accepted by hunspell.

I have done a first short test to check out, that this is a
working solution.
 
Of course the ispell-hunspell-dictionary-alist need extension because 
I have put only two entries to be able to check out my solution.

Best Regards:

Jochen Schmitt

diff -up emacs-24.2/lisp/textmodes/ispell.el.hunspell emacs-24.2/lisp/textmodes/ispell.el
--- emacs-24.2/lisp/textmodes/ispell.el.hunspell	2013-01-17 13:17:45.389785784 +0100
+++ emacs-24.2/lisp/textmodes/ispell.el	2013-01-17 13:19:43.388797273 +0100
@@ -572,6 +572,13 @@ re-start Emacs."
 		       (coding-system :tag "Coding System")))
   :group 'ispell)
 
+(defvar ispell-hunspell-dictionary-alist
+  '((nil "en_GB")
+    ("english" "en_GB")
+    ("american" "en_US")
+   )
+  "Associating list between apell and hunspell dictionaries names"
+)
 
 (defvar ispell-dictionary-base-alist
   '((nil
@@ -2610,7 +2617,9 @@ Keeps argument list for future ispell in
           (append
            (if (and ispell-current-dictionary      ; Not for default dict (nil)
                     (not (member "-d" orig-args))) ; Only define if not overridden.
-               (list "-d" ispell-current-dictionary))
+               (list "-d" (if ispell-really-hunspell
+			      (cadr (assoc ispell-current-dictionary ispell-hunspell-dictionary-alist))
+			   ispell-current-dictionary)))
            orig-args
            (if ispell-current-personal-dictionary ; Use specified pers dict.
                (list "-p"




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13460; Package emacs. (Thu, 17 Jan 2013 18:45:01 GMT) Full text and rfc822 format available.

Message #47 received at 13460 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Agustin Martin <agustin.martin <at> hispalinux.es>
Cc: 13460 <at> debbugs.gnu.org
Subject: Re: bug#13460: Issue to change dictionary when using hunspell on emacs
Date: Thu, 17 Jan 2013 20:42:58 +0200
> Date: Thu, 17 Jan 2013 19:12:34 +0100
> From: Agustin Martin <agustin.martin <at> hispalinux.es>
> 
> Sorry, I should have written WORDCHARS.

Why do we need that?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13460; Package emacs. (Thu, 17 Jan 2013 18:45:02 GMT) Full text and rfc822 format available.

Message #50 received at 13460 <at> debbugs.gnu.org (full text, mbox):

From: Agustin Martin <agustin.martin <at> hispalinux.es>
To: 13460 <at> debbugs.gnu.org
Subject: Re: bug#13460: Issue to change dictionary when using hunspell on emacs
Date: Thu, 17 Jan 2013 19:44:12 +0100
On Thu, Jan 17, 2013 at 01:08:30PM -0500, Glenn Morris wrote:
> Agustin Martin wrote:
> 
> > The problem is that hunspell -D does not return control.
> [...]
> > A workaround was proposed (redirecting from /dev/null), but it seems too
> > UNIX biassed.
> 
> "UNIX biased" -> "does not work on MS Windows" ?
> 
> If the equivalent of "hunspell < null-device" works on MS Windows,
> that's one problem easily solved, no?

I do not use MS Windows myself, so I am just guessing possible problems. 
I was thinking about trying to start playing with /dev/null in my Debian
box, but Eli proposed 'null-device' which seems better.

Anyway, I'd like to have a look at this, but I am having little spare time
now. Will try to find some time soon, but cannot promise. So, if someone did
some work on this, is welcome.

Regards,

-- 
Agustin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13460; Package emacs. (Thu, 17 Jan 2013 19:08:01 GMT) Full text and rfc822 format available.

Message #53 received at 13460 <at> debbugs.gnu.org (full text, mbox):

From: Agustin Martin <agustin.martin <at> hispalinux.es>
To: 13460 <at> debbugs.gnu.org
Subject: Re: bug#13460: Issue to change dictionary when using hunspell on emacs
Date: Thu, 17 Jan 2013 20:06:31 +0100
On Thu, Jan 17, 2013 at 08:42:58PM +0200, Eli Zaretskii wrote:
> > Date: Thu, 17 Jan 2013 19:12:34 +0100
> > From: Agustin Martin <agustin.martin <at> hispalinux.es>
> > 
> > Sorry, I should have written WORDCHARS.
> 
> Why do we need that?

This is what ispell.el calls otherchars. Parsing WORDCHARS ensures that both
hunspell and ispell.el think about the same characters in that category.

-- 
Agustin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13460; Package emacs. (Thu, 17 Jan 2013 19:32:01 GMT) Full text and rfc822 format available.

Message #56 received at 13460 <at> debbugs.gnu.org (full text, mbox):

From: Agustin Martin <agustin.martin <at> hispalinux.es>
To: 13460 <at> debbugs.gnu.org, Jochen Schmitt <Jochen <at> herr-schmitt.de>
Subject: Re: bug#13460: Issue to change dictionary when using hunspell on emacs
Date: Thu, 17 Jan 2013 20:30:29 +0100
From: Jochen Schmitt
> 
> I have try to create a suggestion for a general solution for
> this issue in the next release of emacs.
> 
> I have attached a patch on this mail which introduced a alist to
> translate the dictionary names like 'english' in the form which will
> be accepted by hunspell.
> 
> I have done a first short test to check out, that this is a
> working solution.
>  
> Of course the ispell-hunspell-dictionary-alist need extension because 
> I have put only two entries to be able to check out my solution.

Hi Jochen. Thanks a lot for your feedback (and to Glenn for forwarding it),
you can send your followups to the bug address.

I remember to have done some initial work with an alias file for hunspell,
but I do not find that now.

I'd keep the name `ispell-hunspell-dictionary-alist' for the alist of
actually found dicts, once implemented in one way or another. I vaguely
remember using something like `ispell-hunspell-dictionary-equivs-alist' for
the purpose of having a list of equivalences. I'd also not hardcode nil to
"en_GB".

For the rest I think it can be useful as a temporary workaround, but I'd
prefer to see these changes in a sanitized dictionary alist for hunspell,
something similar to what is done in `ispell-set-spellchecker-params' to use
[:alpha:] when possible, but for this purpose and limited to the original
base alist. Otherwise will only work for entries not using explicit "-d"
and may hide personal choices in ~/.emacs pointing to non-standard locations
(e.g., "american" using "~/personal/en_US". (Looked quickly, may be I missed
something)

Let me try to find where I have my previous work and what is harder, try to
find the time. This should not be that time consuming, so I expect to look
at this shortly.

Thanks again. 

Regards.

-- 
Agustin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13460; Package emacs. (Thu, 17 Jan 2013 19:38:01 GMT) Full text and rfc822 format available.

Message #59 received at 13460 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Agustin Martin <agustin.martin <at> hispalinux.es>
Cc: 13460 <at> debbugs.gnu.org
Subject: Re: bug#13460: Issue to change dictionary when using hunspell on emacs
Date: Thu, 17 Jan 2013 21:36:09 +0200
> Date: Thu, 17 Jan 2013 20:06:31 +0100
> From: Agustin Martin <agustin.martin <at> hispalinux.es>
> 
> On Thu, Jan 17, 2013 at 08:42:58PM +0200, Eli Zaretskii wrote:
> > > Date: Thu, 17 Jan 2013 19:12:34 +0100
> > > From: Agustin Martin <agustin.martin <at> hispalinux.es>
> > > 
> > > Sorry, I should have written WORDCHARS.
> > 
> > Why do we need that?
> 
> This is what ispell.el calls otherchars. Parsing WORDCHARS ensures that both
> hunspell and ispell.el think about the same characters in that category.

I think you are mistaken, that's not my reading of hunspell(4).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13460; Package emacs. (Fri, 18 Jan 2013 17:06:01 GMT) Full text and rfc822 format available.

Message #62 received at 13460 <at> debbugs.gnu.org (full text, mbox):

From: Agustin Martin <agustin.martin <at> hispalinux.es>
To: 13460 <at> debbugs.gnu.org
Cc: Jochen Schmitt <Jochen <at> herr-schmitt.de>
Subject: Re: bug#13460: Issue to change dictionary when using hunspell on emacs
Date: Fri, 18 Jan 2013 18:05:01 +0100
[Message part 1 (text/plain, inline)]
On Thu, Jan 17, 2013 at 08:30:29PM +0100, Agustin Martin wrote:
> From: Jochen Schmitt
> > 
> > I have try to create a suggestion for a general solution for
> > this issue in the next release of emacs.
> > 
> > I have attached a patch on this mail which introduced a alist to
> > translate the dictionary names like 'english' in the form which will
> > be accepted by hunspell.
> > 
> > I have done a first short test to check out, that this is a
> > working solution.
> >  
> > Of course the ispell-hunspell-dictionary-alist need extension because 
> > I have put only two entries to be able to check out my solution.
> 
> Hi Jochen. Thanks a lot for your feedback (and to Glenn for forwarding it),
> you can send your followups to the bug address.
> 
> I remember to have done some initial work with an alias file for hunspell,
> but I do not find that now.
> 
> I'd keep the name `ispell-hunspell-dictionary-alist' for the alist of
> actually found dicts, once implemented in one way or another. I vaguely
> remember using something like `ispell-hunspell-dictionary-equivs-alist' for
> the purpose of having a list of equivalences. I'd also not hardcode nil to
> "en_GB".
> 
> For the rest I think it can be useful as a temporary workaround, but I'd
> prefer to see these changes in a sanitized dictionary alist for hunspell,
> something similar to what is done in `ispell-set-spellchecker-params' to use
> [:alpha:] when possible, but for this purpose and limited to the original
> base alist. Otherwise will only work for entries not using explicit "-d"
> and may hide personal choices in ~/.emacs pointing to non-standard locations
> (e.g., "american" using "~/personal/en_US". (Looked quickly, may be I missed
> something)
> 
> Let me try to find where I have my previous work and what is harder, try to
> find the time. This should not be that time consuming, so I expect to look
> at this shortly.

I have been playing with this. Please see attached patch for current status.
There are a couple of minor things I would like to think about first.

Current changes explicitly set "english" to one of the two main choices
("en_GB"). This  is not something I like very much and I am aware that
people is sensitive about this. I'd prefer to associate it with plain "en",
but hunspell has some pending issues regarding fallback values.

Since there should be mapppings for all (but nil) default dict definitions, 
and this is only done for those dicts I am also considering to show an error
if an expected mappping is not found, but this is a really minor internal
issue just to help finding missing mappings early.

I will test these changes a bit more and if no problems appear will commit
early next week. Feedback is welcome.

Thanks again for your suggestions.

-- 
Agustin
[ispell.el_hunspell-default-dict-names-mapping.diff (text/x-diff, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13460; Package emacs. (Fri, 18 Jan 2013 18:05:02 GMT) Full text and rfc822 format available.

Message #65 received at 13460 <at> debbugs.gnu.org (full text, mbox):

From: Jochen Schmitt <Jochen <at> herr-schmitt.de>
To: 13460 <at> debbugs.gnu.org
Subject: Re: bug#13460: Issue to change dictionary when using hunspell on emacs
Date: Fri, 18 Jan 2013 19:03:34 +0100
On Fri, Jan 18, 2013 at 06:05:01PM +0100, Agustin Martin wrote:
> On Thu, Jan 17, 2013 at 08:30:29PM +0100, Agustin Martin wrote:
> There are a couple of minor things I would like to think about first.
> 
> Current changes explicitly set "english" to one of the two main choices
> ("en_GB"). This  is not something I like very much and I am aware that
> people is sensitive about this. I'd prefer to associate it with plain "en",
>

I have find out, that hunspell wiel accecpt -d en_GB,en_US as
an parameter, so this issue may be fixed.
 
> I will test these changes a bit more and if no problems appear will commit
> early next week. Feedback is welcome.
>
I will be happy, if you can notifiy me about the state of your work, 
because I want that this patch may be integrated in the official
emacs package of Fedora Linux. This is important from my point of
view, because hunspell is the default spell checking application
in Fedora.

Best Regards:

Jochen Schmitt




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13460; Package emacs. (Fri, 18 Jan 2013 19:04:02 GMT) Full text and rfc822 format available.

Message #68 received at 13460 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Jochen Schmitt <Jochen <at> herr-schmitt.de>
Cc: 13460 <at> debbugs.gnu.org
Subject: Re: bug#13460: Issue to change dictionary when using hunspell on emacs
Date: Fri, 18 Jan 2013 21:03:17 +0200
> Date: Fri, 18 Jan 2013 19:03:34 +0100
> From: Jochen Schmitt <Jochen <at> herr-schmitt.de>
> 
> I have find out, that hunspell wiel accecpt -d en_GB,en_US as
> an parameter, so this issue may be fixed.

Beware: when you invoke hunspell like that, it uses the .aff file from
the first dictionary only, and ignores any .aff files of the other
dictionaries.  This could bite you where US and GB English differ.

In general, this option is meant to support _additional_ dictionaries
in the same language, like if you want to use a specialized dictionary
for medicine or some other discipline, together with a general-purpose
dictionary for the same language.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13460; Package emacs. (Fri, 18 Jan 2013 19:07:02 GMT) Full text and rfc822 format available.

Message #71 received at 13460 <at> debbugs.gnu.org (full text, mbox):

From: Agustin Martin <agustin.martin <at> hispalinux.es>
To: 13460 <at> debbugs.gnu.org
Cc: Jochen Schmitt <Jochen <at> herr-schmitt.de>
Subject: Re: bug#13460: Issue to change dictionary when using hunspell on emacs
Date: Fri, 18 Jan 2013 20:05:41 +0100
On Fri, Jan 18, 2013 at 07:03:34PM +0100, Jochen Schmitt wrote:
> On Fri, Jan 18, 2013 at 06:05:01PM +0100, Agustin Martin wrote:
> > On Thu, Jan 17, 2013 at 08:30:29PM +0100, Agustin Martin wrote:
> > There are a couple of minor things I would like to think about first.
> > 
> > Current changes explicitly set "english" to one of the two main choices
> > ("en_GB"). This  is not something I like very much and I am aware that
> > people is sensitive about this. I'd prefer to associate it with plain "en",
> >
> 
> I have find out, that hunspell wiel accecpt -d en_GB,en_US as
> an parameter, so this issue may be fixed.

Thanks for the info.

I am not native English, so I am a bit unsure that this is the desired
behavior, people may get puzzled by "english" accepting simultaneously
"center/centre", "colour/color" and friends. What native English people
think about this?

There is also the fact that first dict in that list must always be installed,
otherwise we get the dict not found error. In most setups both dicts are
installed, so this should not be a big problem, but I'd put first the most
popular, en_US.

> > I will test these changes a bit more and if no problems appear will commit
> > early next week. Feedback is welcome.
> >
> I will be happy, if you can notifiy me about the state of your work, 
> because I want that this patch may be integrated in the official
> emacs package of Fedora Linux. This is important from my point of
> view, because hunspell is the default spell checking application
> in Fedora.

Once I commit changes I will close the bug report and you will receive a
message about it. If you want the final diff I can attach it to the closing
message.

Regards,

-- 
Agustin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13460; Package emacs. (Fri, 18 Jan 2013 19:25:02 GMT) Full text and rfc822 format available.

Message #74 received at 13460 <at> debbugs.gnu.org (full text, mbox):

From: Agustin Martin <agustin.martin <at> hispalinux.es>
To: 13460 <at> debbugs.gnu.org
Cc: Jochen Schmitt <Jochen <at> herr-schmitt.de>
Subject: Re: bug#13460: Issue to change dictionary when using hunspell on emacs
Date: Fri, 18 Jan 2013 20:23:45 +0100
On Fri, Jan 18, 2013 at 09:03:17PM +0200, Eli Zaretskii wrote:
> > Date: Fri, 18 Jan 2013 19:03:34 +0100
> > From: Jochen Schmitt <Jochen <at> herr-schmitt.de>
> > 
> > I have find out, that hunspell wiel accecpt -d en_GB,en_US as
> > an parameter, so this issue may be fixed.
> 
> Beware: when you invoke hunspell like that, it uses the .aff file from
> the first dictionary only, and ignores any .aff files of the other
> dictionaries.  This could bite you where US and GB English differ.
> 
> In general, this option is meant to support _additional_ dictionaries
> in the same language, like if you want to use a specialized dictionary
> for medicine or some other discipline, together with a general-purpose
> dictionary for the same language.

Replied to Jochen message just before receiving your message and noticing that
I forgot that this indeed was for additional dictionaries and that only
first aff is used, thanks for reminding.

I can now think about another possible problem with this. hunspell accepts
both hunspell only and old myspell dicts. If e.g. en_GB has a myspell aff
file (and .dic file for that .aff file) and en_US a hunspell only one (and
associated .dic file for it), when using "-d en_GB,en_US" interaction may
become at least strange if not unpredictable.

-- 
Agustin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13460; Package emacs. (Mon, 21 Jan 2013 09:45:02 GMT) Full text and rfc822 format available.

Message #77 received at 13460 <at> debbugs.gnu.org (full text, mbox):

From: Jochen Schmitt <Jochen <at> herr-schmitt.de>
To: 13460 <at> debbugs.gnu.org
Subject: Re: bug#13460: Issue to change dictionary when using hunspell on emacs
Date: Mon, 21 Jan 2013 10:43:40 +0100
[Message part 1 (text/plain, inline)]
On Fri, Jan 18, 2013 at 06:05:01PM +0100, Agustin Martin wrote:

> I have been playing with this. Please see attached patch for current status.
> There are a couple of minor things I would like to think about first.
> 
> Current changes explicitly set "english" to one of the two main choices
> ("en_GB"). This  is not something I like very much and I am aware that
> people is sensitive about this. I'd prefer to associate it with plain "en",
> but hunspell has some pending issues regarding fallback values.
> 
> Since there should be mapppings for all (but nil) default dict definitions, 
> and this is only done for those dicts I am also considering to show an error
> if an expected mappping is not found, but this is a really minor internal
> issue just to help finding missing mappings early.
> 
> I will test these changes a bit more and if no problems appear will commit
> early next week. Feedback is welcome.

I have add a monor change to your suggested patch to generate
an error message, if a language doesn't exist in ispell-hunspell-equivs-alist.

My tests show, that this parch works as expected.

I have attached the modified version of the patch on this mail.

Best Regards:

Jochen Schmitt
[emacs-24.2-hunspell.patch (text/plain, attachment)]

Reply sent to Agustin Martin <agustin.martin <at> hispalinux.es>:
You have taken responsibility. (Mon, 21 Jan 2013 16:54:01 GMT) Full text and rfc822 format available.

Notification sent to Jochen Schmitt <Jochen <at> herr-schmitt.de>:
bug acknowledged by developer. (Mon, 21 Jan 2013 16:54:02 GMT) Full text and rfc822 format available.

Message #82 received at 13460-done <at> debbugs.gnu.org (full text, mbox):

From: Agustin Martin <agustin.martin <at> hispalinux.es>
To: 13460-done <at> debbugs.gnu.org
Subject: Re: bug#13460: Issue to change dictionary when using hunspell on emacs
Date: Mon, 21 Jan 2013 17:52:38 +0100
On Fri, Jan 18, 2013 at 08:05:41PM +0100, Agustin Martin wrote:
> On Fri, Jan 18, 2013 at 07:03:34PM +0100, Jochen Schmitt wrote:
> > On Fri, Jan 18, 2013 at 06:05:01PM +0100, Agustin Martin wrote:
> > > I will test these changes a bit more and if no problems appear will commit
> > > early next week. Feedback is welcome.
> > >
> > I will be happy, if you can notifiy me about the state of your work, 
> > because I want that this patch may be integrated in the official
> > emacs package of Fedora Linux. This is important from my point of
> > view, because hunspell is the default spell checking application
> > in Fedora.
> 
> Once I commit changes I will close the bug report and you will receive a
> message about it. If you want the final diff I can attach it to the closing
> message.

Fix committed, closing bug report.

For english I left en_US alone. For the reasons shown in the bug thread I
think is not a good idea to mix them.

I have relaxed a bit the check, if a standard dict does not have an
associated hunspell mapping it is ignored for hunspell with a warning,
so error message will only appear when trying to use that dict instead
of everytime hunspell is used as spellchecker.

Regards,

-- 
Agustin




bug 13460 cloned as bug 13639. Request was from Agustin Martin <agustin.martin <at> hispalinux.es> to control <at> debbugs.gnu.org. (Wed, 06 Feb 2013 18:21:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 07 Mar 2013 12:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 59 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.