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: Tue, 07 Mar 2017 18:51:54 +0200 Message-ID: <83k281ghcl.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> <83d1dvk9wp.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1488905595 19747 195.159.176.226 (7 Mar 2017 16:53:15 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 7 Mar 2017 16:53:15 +0000 (UTC) Cc: 25830@debbugs.gnu.org To: mk@linux.com Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Mar 07 17:53:11 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 1clIMG-0004Th-Ds for geb-bug-gnu-emacs@m.gmane.org; Tue, 07 Mar 2017 17:53:08 +0100 Original-Received: from localhost ([::1]:51660 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1clIMM-0001tC-I7 for geb-bug-gnu-emacs@m.gmane.org; Tue, 07 Mar 2017 11:53:14 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42411) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1clIMD-0001sM-EZ for bug-gnu-emacs@gnu.org; Tue, 07 Mar 2017 11:53:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1clIMA-0003j6-Oo for bug-gnu-emacs@gnu.org; Tue, 07 Mar 2017 11:53:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:46637) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1clIMA-0003j2-LZ for bug-gnu-emacs@gnu.org; Tue, 07 Mar 2017 11:53:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1clIMA-0005sT-FD for bug-gnu-emacs@gnu.org; Tue, 07 Mar 2017 11:53:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 07 Mar 2017 16:53:02 +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.148890554922524 (code B ref 25830); Tue, 07 Mar 2017 16:53:02 +0000 Original-Received: (at 25830) by debbugs.gnu.org; 7 Mar 2017 16:52:29 +0000 Original-Received: from localhost ([127.0.0.1]:44831 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1clILd-0005rE-Eq for submit@debbugs.gnu.org; Tue, 07 Mar 2017 11:52:29 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:50966) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1clILc-0005qz-QF for 25830@debbugs.gnu.org; Tue, 07 Mar 2017 11:52:29 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1clILW-0003Sd-9l for 25830@debbugs.gnu.org; Tue, 07 Mar 2017 11:52:23 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:39931) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1clILW-0003SX-6D; Tue, 07 Mar 2017 11:52:22 -0500 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:4085 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1clILV-0000k7-G9; Tue, 07 Mar 2017 11:52:21 -0500 In-reply-to: <83d1dvk9wp.fsf@gnu.org> (message from Eli Zaretskii on Sun, 05 Mar 2017 17:42:14 +0200) 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:130317 Archived-At: Ping! (The previous message to you bounced.) > Date: Sun, 05 Mar 2017 17:42:14 +0200 > From: Eli Zaretskii > Cc: 25830@debbugs.gnu.org > > > 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. > > > >