From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Kisaragi Hiu via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#49982: 27.2; ispell.el fails to find a Hunspell dictionary to use as default despite ispell-dictionary being set Date: Wed, 11 Aug 2021 00:12:06 +0900 Message-ID: <59517c95-6568-f646-7097-c601cc9657c9@kisaragi-hiu.com> Reply-To: Kisaragi Hiu Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36953"; mail-complaints-to="usenet@ciao.gmane.io" To: 49982@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Aug 10 17:13:12 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mDTRH-0009QG-8A for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 10 Aug 2021 17:13:12 +0200 Original-Received: from localhost ([::1]:48668 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mDTRF-0005Lk-Vl for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 10 Aug 2021 11:13:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39442) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mDTR8-0005KW-FH for bug-gnu-emacs@gnu.org; Tue, 10 Aug 2021 11:13:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:48890) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mDTR8-0005sM-8E for bug-gnu-emacs@gnu.org; Tue, 10 Aug 2021 11:13:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mDTR8-0007kA-4X for bug-gnu-emacs@gnu.org; Tue, 10 Aug 2021 11:13:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Kisaragi Hiu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 10 Aug 2021 15:13:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 49982 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.162860834729717 (code B ref -1); Tue, 10 Aug 2021 15:13:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 10 Aug 2021 15:12:27 +0000 Original-Received: from localhost ([127.0.0.1]:60436 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mDTQV-0007jC-IH for submit@debbugs.gnu.org; Tue, 10 Aug 2021 11:12:27 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:34416) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mDTQQ-0007j0-U4 for submit@debbugs.gnu.org; Tue, 10 Aug 2021 11:12:22 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39208) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mDTQQ-00048V-NW for bug-gnu-emacs@gnu.org; Tue, 10 Aug 2021 11:12:18 -0400 Original-Received: from out0.migadu.com ([2001:41d0:2:267::]:12859) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mDTQM-00059E-V3 for bug-gnu-emacs@gnu.org; Tue, 10 Aug 2021 11:12:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kisaragi-hiu.com; s=key1; t=1628608330; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jOx8Yxys/V1bAfoGIM+G/tc+H93rU52iMITzwjsNbzg=; b=3qhoeRWUhnLuLq4QzPz3Rc1x4hv6Ejh41whoLZDqKtKQS44flBPtqD/Voqik8Elz4GUXAF 14SXkm7J7txdEwp5Whlz+bbafqK66CEp8MbgqrGhB86cFiEPCa5jM6JrAEsVhGpOCkx7tn S8YymQ3FDvGHrtf6qzUE9dbcMu0N/PEezIlAwEcVO9mX8CtL2+VBwrop2Gfi28eAVjWNzn TR97STWTACs/+5Uo/GsIfWyC1HnpedYrgRvm3b0HU+P/wb5yrFfvcLlhvR5hhrK8QSsNYM PRAfiW0ydaWQlun7M0s3qjtZEd+EZkgGgHhHuE9POyeH1rUNz/58sRXpEbSddA== X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. Content-Language: en-US X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: mail@kisaragi-hiu.com Received-SPF: pass client-ip=2001:41d0:2:267::; envelope-from=mail@kisaragi-hiu.com; helo=out0.migadu.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:211513 Archived-At: This configuration should be everything that's needed for ispell.el to work with Hunspell, regardless of system locale: (setq ispell-program-name (executable-find "hunspell") ispell-dictionary "en_US")) However, when system locale (the LANG environment variable) does not have a corresponding Hunspell dictionary, `ispell-find-hunspell-dictionaries` returns the error "Can't find Hunspell dictionary with a .aff affix file", despite ispell-dictionary being set. ispell.el relies on Hunspell to load a default and report it, but Hunspell just errors out if it can't find a dictionary for the system locale. And because ispell.el is trying to get Hunspell's default dictionary, it doesn't pass `ispell-dictionary' onto Hunspell. This behavior is surprising. If `ispell-dictionary` is non-nil, that means the user has already specified their preferred dictionary, and it should not matter that Hunspell cannot find the dictionary it would use when a preferred dictionary isn't specified. It's ispell.el that needs to be fixed here because the user specifies their preference in Emacs, and it is its job to communicate that preference to Hunspell. `ispell-find-hunspell-dictionaries` should pass "-d ${ispell-dictionary}" to Hunspell if `ispell-dictionary` is set. This invocation: hunspell -d "en_US" -D /dev/null works as expected regardless of the system locale. * System info In GNU Emacs 27.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.27, cairo version 1.17.4) of 2021-03-27 built on juergen Windowing system distributor 'The X.Org Foundation', version 11.0.12013000 System Description: Arch Linux Hunspell 1.7.0; hunspell -D is SEARCH PATH: .::/usr/share/hunspell:/usr/share/myspell:/usr/share/myspell/dicts:/Library/Spelling:/home/kisaragi-hiu/.openoffice.org/3/user/wordbook:/home/kisaragi-hiu/.openoffice.org2/user/wordbook:/home/kisaragi-hiu/.openoffice.org2.0/user/wordbook:/home/kisaragi-hiu/Library/Spelling:/opt/openoffice.org/basis3.0/share/dict/ooo:/usr/lib/openoffice.org/basis3.0/share/dict/ooo:/opt/openoffice.org2.4/share/dict/ooo:/usr/lib/openoffice.org2.4/share/dict/ooo:/opt/openoffice.org2.3/share/dict/ooo:/usr/lib/openoffice.org2.3/share/dict/ooo:/opt/openoffice.org2.2/share/dict/ooo:/usr/lib/openoffice.org2.2/share/dict/ooo:/opt/openoffice.org2.1/share/dict/ooo:/usr/lib/openoffice.org2.1/share/dict/ooo:/opt/openoffice.org2.0/share/dict/ooo:/usr/lib/openoffice.org2.0/share/dict/ooo AVAILABLE DICTIONARIES (path is not mandatory for -d option): ... [truncated] /usr/share/hunspell/en_US-large ... [truncated] * Reproduction - Notice how Hunspell does not return LOADED DICTIONARY under, for example, ja_JP: export LANG=ja_JP hunspell -D /dev/null # Output: # ... [truncated] # Can't open affix or dictionary files for dictionary named "ja_JP". - Now, in Emacs with LANG set to ja_JP, set ispell up with Hunspell as usual. (setq ispell-program-name (executable-find "hunspell") ispell-dictionary "en_US")) - Observe the error. (ispell-start-process) ;; -> ispell-find-hunspell-dictionaries: Can’t find Hunspell dictionary with a .aff affix file