GNU bug report logs - #25830
25.2; ispell doesn't parse hunspell dictionaries properly

Previous Next

Package: emacs;

Reported by: Martin Kletzander <mk <at> linux.com>

Date: Tue, 21 Feb 2017 16:05:02 UTC

Severity: normal

Found in version 25.2

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


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

From: Eli Zaretskii <eliz <at> gnu.org>
To: mk <at> linux.com
Cc: 25830 <at> debbugs.gnu.org
Subject: Re: bug#25830: 25.2;
 ispell doesn't parse hunspell dictionaries properly
Date: Tue, 07 Mar 2017 18:51:54 +0200
Ping!  (The previous message to you bounced.)

> Date: Sun, 05 Mar 2017 17:42:14 +0200
> From: Eli Zaretskii <eliz <at> gnu.org>
> Cc: 25830 <at> debbugs.gnu.org
> 
> > Date: Tue, 28 Feb 2017 22:53:52 +0100
> > From: Martin Kletzander <mk <at> linux.com>
> > Cc: 25830 <at> debbugs.gnu.org
> > 
> > >Please try the patch below.  (If it doesn't apply to your version of
> > >ispell.el, tell me which version of Emacs you have, and I will try to
> > >produce a compatible patch.)
> > >
> > 
> > Sorry I didn't get to this earlier.
> 
> Now it's my turn to apologize for the delay...
> 
> > One of the hunks didn't apply correctly, so I used the file from
> > master and it applied correctly.  So with your patch applied on top
> > of ispell.el from current master, the situation is way better.  But
> > I feel like it still doesn't work as expected.  Not that anything
> > would be broken, but it uses only the first dictionary found.
> 
> You are right, that was the wrong direction to try to solve the
> problem.
> 
> Here's another attempt.  It should be applied _instead_ of the
> previous patch, to the original version of ispell.el.  Let me know if
> it works OK for you.
> 
> Thanks.
> 
> --- lisp/textmodes/ispell.el~0	2017-01-08 06:23:52.000000000 +0200
> +++ lisp/textmodes/ispell.el	2017-03-05 17:21:10.441710400 +0200
> @@ -1094,10 +1094,10 @@
>  
>  (defun ispell-find-hunspell-dictionaries ()
>    "Look for installed Hunspell dictionaries.
> -Will initialize `ispell-hunspell-dictionary-alist' and
> -`ispell-hunspell-dictionary-alist' after values found
> -and remove `ispell-dicts-name2locale-equivs-alist'
> -entries if a specific dictionary was found."
> +Will initialize `ispell-hunspell-dictionary-alist' according
> +to dictionaries found, and will remove aliases from the list
> +in `ispell-dicts-name2locale-equivs-alist' if an explicit
> +dictionary from that list was found."
>    (let ((hunspell-found-dicts
>  	 (split-string
>  	  (with-temp-buffer
> @@ -1110,18 +1110,27 @@
>  	  "[\n\r]+"
>  	  t))
>  	hunspell-default-dict
> -	hunspell-default-dict-entry)
> +	hunspell-default-dict-entry
> +	hunspell-multi-dict)
>      (dolist (dict hunspell-found-dicts)
>        (let* ((full-name (file-name-nondirectory dict))
>  	     (basename  (file-name-sans-extension full-name))
>  	     (affix-file (concat dict ".aff")))
>  	(if (string-match "\\.aff$" dict)
>  	    ;; Found default dictionary
> -	    (if hunspell-default-dict
> -		(error "ispell-fhd: Default dict already defined as %s.  Not using %s.\n"
> -		       hunspell-default-dict dict)
> -	      (setq affix-file dict)
> -	      (setq hunspell-default-dict (list basename affix-file)))
> +	    (progn
> +	      (if hunspell-default-dict
> +		  (setq hunspell-multi-dict
> +			(concat (or hunspell-multi-dict
> +				    (car hunspell-default-dict))
> +				"," basename))
> +		(setq affix-file dict)
> +		;; FIXME: The cdr of the list we cons below is never
> +		;; used.  Why do we need a list?
> +		(setq hunspell-default-dict (list basename affix-file)))
> +	      (ispell-print-if-debug
> +	       "++ ispell-fhd: default dict-entry:%s name:%s basename:%s\n"
> +	       dict full-name basename))
>  	  (if (and (not (assoc basename ispell-hunspell-dict-paths-alist))
>  		   (file-exists-p affix-file))
>  	      ;; Entry has an associated .aff file and no previous value.
> @@ -1161,7 +1170,8 @@
>  	      (cl-pushnew (list dict-equiv-key affix-file)
>                            ispell-hunspell-dict-paths-alist :test #'equal)))))
>      ;; Parse and set values for default dictionary.
> -    (setq hunspell-default-dict (car hunspell-default-dict))
> +    (setq hunspell-default-dict (or hunspell-multi-dict
> +				    (car hunspell-default-dict)))
>      (setq hunspell-default-dict-entry
>  	  (ispell-parse-hunspell-affix-file hunspell-default-dict))
>      ;; Create an alist of found dicts with only names, except for default dict.
> 
> 
> 
> 




This bug report was last modified 8 years and 61 days ago.

Previous Next


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