From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#25830: 25.2; ispell doesn't parse hunspell dictionaries properly Date: Sun, 05 Mar 2017 17:42:14 +0200 Message-ID: <83d1dvk9wp.fsf@gnu.org> References: <20170221091857.GA4096@wheatley> <83k28jo3ur.fsf@gnu.org> <20170221202454.GA30086@wheatley> <83fuj7tgto.fsf@gnu.org> <20170222104025.GA3557@wheatley> <83d1eatcxo.fsf@gnu.org> <20170222164310.GA3470@wheatley> <83efymsmnt.fsf@gnu.org> <20170225121523.GA9164@wheatley> <83poi3pr23.fsf@gnu.org> <20170228215352.GB29225@wheatley> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1488728592 9338 195.159.176.226 (5 Mar 2017 15:43:12 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 5 Mar 2017 15:43:12 +0000 (UTC) Cc: 25830@debbugs.gnu.org To: Martin Kletzander Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Mar 05 16:43:08 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ckYJP-0001sd-5L for geb-bug-gnu-emacs@m.gmane.org; Sun, 05 Mar 2017 16:43:07 +0100 Original-Received: from localhost ([::1]:39178 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ckYJV-0000PW-6l for geb-bug-gnu-emacs@m.gmane.org; Sun, 05 Mar 2017 10:43:13 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41522) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ckYJO-0000PF-CS for bug-gnu-emacs@gnu.org; Sun, 05 Mar 2017 10:43:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ckYJJ-00032N-W4 for bug-gnu-emacs@gnu.org; Sun, 05 Mar 2017 10:43:06 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:42922) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ckYJJ-00032I-Rz for bug-gnu-emacs@gnu.org; Sun, 05 Mar 2017 10:43:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ckYJJ-0006C4-M4 for bug-gnu-emacs@gnu.org; Sun, 05 Mar 2017 10:43:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 05 Mar 2017 15:43:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 25830 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 25830-submit@debbugs.gnu.org id=B25830.148872855623774 (code B ref 25830); Sun, 05 Mar 2017 15:43:01 +0000 Original-Received: (at 25830) by debbugs.gnu.org; 5 Mar 2017 15:42:36 +0000 Original-Received: from localhost ([127.0.0.1]:41121 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ckYIu-0006BN-8Y for submit@debbugs.gnu.org; Sun, 05 Mar 2017 10:42:36 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:50424) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ckYIr-0006BA-UY for 25830@debbugs.gnu.org; Sun, 05 Mar 2017 10:42:34 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ckYIi-0002rR-9E for 25830@debbugs.gnu.org; Sun, 05 Mar 2017 10:42:28 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:60347) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ckYIi-0002rM-5h; Sun, 05 Mar 2017 10:42:24 -0500 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:1411 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1ckYIh-0007kG-Dw; Sun, 05 Mar 2017 10:42:23 -0500 In-reply-to: <20170228215352.GB29225@wheatley> (message from Martin Kletzander on Tue, 28 Feb 2017 22:53:52 +0100) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:130209 Archived-At: > Date: Tue, 28 Feb 2017 22:53:52 +0100 > From: Martin Kletzander > Cc: 25830@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.