Subject: bug#24435: 25.1; Problem using Hunspell

From: Dmitri Paduchikh <[email-masked]>
Date: Wed, 14 Sep 2016 20:33:53 +0500

Hello,

Noam Postavsky <[email-masked]> wrote:

> On Wed, Sep 14, 2016 at 9:24 AM, Dmitri Paduchikh <[email-masked]> wrote:

>> Hello,
>>
>> Judging from ispell.el it should work with Hunspell, so I tried to use
>> it. But attempts to check a word produce the following error message.
>>
>> | Starting new Ispell process hunspell with ru_RU dictionary...
>> | hunspell release 3.1.12 or greater is required (ispell-check-version)
>>
>> The latest version of Hunspell is 1.4.1 as can be seen here:
>> https://github.com/hunspell/hunspell/releases
>>
>> As I understand, the problem arises because ispell-check-version finds
>> version information using regexp
>>
>> "(but really Hunspell \\([0-9]+\\.[0-9\\.-]+\\)?)"
>>
>> The output of hunspell -vv does not match it, hence the results.
>>
>> $ hunspell -vv < /dev/null
>> Hunspell 1.4.0

> I guess older Hunspell versions printed a different string. Does it
> work if you change the regexp to

> "\\(?:(but really \\)?Hunspell \\([0-9]+\\.[0-9\\.-]+\\)?)?"

Sadly, it does not. The immediate cause of this error message is that
regexp for ispell-program-version matches the Hunspell output. Then the
corresponding check for Ispell version produces this error. The change
shown below makes the version check pass, but another problem appears:

| Starting new Ispell process hunspell with ru_RU dictionary...
| ispell-phaf: No matching entry for ru_RU in ‘ispell-hunspell-dict-paths-alist’.
|  (ispell-parse-hunspell-affix-file)

It seems that Hunspell itself does not have any difficulty locating the
dictionary.

$ hunspell -a -d ru_RU
Hunspell 1.4.0
проверкаа
& проверкаа 3 0: проверка, проверкам, проверках

Below is the change I made to work arround the version check.

--- orig/ispell.el	2016-06-29 23:52:37.000000000 +0500
+++ ispell.el	2016-09-14 20:01:50.529079147 +0500
@@ -881,7 +881,7 @@
       ;; Get relevant version strings. Only xx.yy.... format works well
       (let (case-fold-search)
 	(setq ispell-program-version
-	      (and (search-forward-regexp "\\([0-9]+\\.[0-9\\.]+\\)" nil t)
+	      (and (search-forward-regexp "\\bIspell Version \\([0-9]+\\.[0-9\\.]+\\)" nil t)
 		   (match-string 1)))
 
 	;; Make sure these variables are (re-)initialized to the default value
@@ -897,7 +897,7 @@
 		       (match-string 1)))
 	    (setq ispell-really-hunspell
 		  (and (search-forward-regexp
-			"(but really Hunspell \\([0-9]+\\.[0-9\\.-]+\\)?)"
+			"\\bHunspell \\([0-9]+\\.[0-9-.]+\\)?"
                         nil t)
 		       (match-string 1)))))
 
@@ -907,12 +907,13 @@
 	    (ispell-minver    "3.1.12")
 	    (hunspell8-minver "1.1.6"))
 
-	(if (ispell-check-minver ispell0-minver ispell-program-version)
-	    (or (ispell-check-minver ispell-minver ispell-program-version)
-		(setq ispell-offset 0))
-	  (error "%s release %s or greater is required"
-		 ispell-program-name
-		 ispell-minver))
+	(cond ((or (null ispell-program-version)
+                   (ispell-check-minver ispell-minver ispell-program-version)))
+              ((ispell-check-minver ispell0-minver ispell-program-version)
+               (setq ispell-offset 0))
+              (:else (error "%s release %s or greater is required"
+                            ispell-program-name
+                            ispell-minver)))
 
 	(cond
 	 (ispell-really-aspell