From debbugs-submit-bounces@debbugs.gnu.org Tue Aug 10 11:12:27 2021 Received: (at submit) by debbugs.gnu.org; 10 Aug 2021 15:12:27 +0000 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 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 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 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 To: bug-gnu-emacs@gnu.org 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== Subject: 27.2; ispell.el fails to find a Hunspell dictionary to use as default despite ispell-dictionary being set X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Kisaragi Hiu Message-ID: <59517c95-6568-f646-7097-c601cc9657c9@kisaragi-hiu.com> Date: Wed, 11 Aug 2021 00:12:06 +0900 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit 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-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) 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$B!G(Bt find Hunspell dictionary with a .aff affix file From debbugs-submit-bounces@debbugs.gnu.org Tue Aug 10 12:03:17 2021 Received: (at 49982) by debbugs.gnu.org; 10 Aug 2021 16:03:17 +0000 Received: from localhost ([127.0.0.1]:60548 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mDUDl-0002sE-40 for submit@debbugs.gnu.org; Tue, 10 Aug 2021 12:03:17 -0400 Received: from eggs.gnu.org ([209.51.188.92]:42420) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mDUDg-0002rx-5Q for 49982@debbugs.gnu.org; Tue, 10 Aug 2021 12:03:16 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:55186) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mDUDZ-0000PN-Ly; Tue, 10 Aug 2021 12:03:05 -0400 Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:2122 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mDUDR-00006t-Sz; Tue, 10 Aug 2021 12:03:05 -0400 Date: Tue, 10 Aug 2021 19:03:07 +0300 Message-Id: <83h7fxfft0.fsf@gnu.org> From: Eli Zaretskii To: Kisaragi Hiu In-Reply-To: <59517c95-6568-f646-7097-c601cc9657c9@kisaragi-hiu.com> (bug-gnu-emacs@gnu.org) Subject: Re: bug#49982: 27.2; ispell.el fails to find a Hunspell dictionary to use as default despite ispell-dictionary being set References: <59517c95-6568-f646-7097-c601cc9657c9@kisaragi-hiu.com> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 49982 Cc: 49982@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Wed, 11 Aug 2021 00:12:06 +0900 > From: Kisaragi Hiu via "Bug reports for GNU Emacs, > the Swiss army knife of text editors" > > 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. Thanks for the report and the analysis. Frankly, I'm a bit wary of making the proposed change unconditionally. First, yours is an unusual use case, I think: when Hunspell is installed, the dictionary that corresponds to the locale is always installed, because otherwise Hunspell will not work reliably from the shell command line. And second, relying on the non-nil value of ispell-dictionary is fragile: the value could be a remnant from some previous invocation or from an unsuccessful customization that has nothing to do with the user's choice or his/her current intent. Moreover, if you manually set ispell-dictionary, then what would be the purpose of calling ispell-find-hunspell-dictionaries at all? So maybe we should add a new user option that would force using the value of ispell-dictionary right from the start. That would at least avoid the risk of breaking somebody else's use case. I wonder if anyone else has an opinion about this. From debbugs-submit-bounces@debbugs.gnu.org Tue Aug 10 14:51:40 2021 Received: (at 49982) by debbugs.gnu.org; 10 Aug 2021 18:51:40 +0000 Received: from localhost ([127.0.0.1]:60832 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mDWqd-0005Lm-Gd for submit@debbugs.gnu.org; Tue, 10 Aug 2021 14:51:39 -0400 Received: from out0.migadu.com ([94.23.1.103]:17437) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mDWqW-0005LY-9i for 49982@debbugs.gnu.org; Tue, 10 Aug 2021 14:51:33 -0400 Subject: Re: bug#49982: 27.2; ispell.el fails to find a Hunspell dictionary to use as default despite ispell-dictionary being set DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kisaragi-hiu.com; s=key1; t=1628621486; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0bxGdJnc1BlDOvK1EN0lIN96qvWiuFn2Pg5V6PNhuaw=; b=eNuJlUDfpntYo0/6aOT5i8AA+JKxq0ff3H+L+oehtCeMH93WZdYbcuzsFLL299FbgbbtOK BEJqN39PZECJI0WapgCHAAV9Tl5rPlSM6s7gq+aWeaNCIjg5xeI0EvRj9NxJFtfhmOOO7x FKE9HnNxJd/VqWjdY4WqU5gLbK/0328nw2BQUMLElLkA/DDaSJz7GsXg7ydzvP6m4m32D/ alXidj9EvzDKSMQQaAa2Oh19YXf03xzVXfzpJsrSyP5XHQrB8Y8eStnhcLKA6J9NQbAHEV 8xQBLjrOwvYj/pg33FxVYbhlnUPHnzBnhJOYuADalO/03fC4nkLh+SkHiPaLTA== To: Eli Zaretskii References: <59517c95-6568-f646-7097-c601cc9657c9@kisaragi-hiu.com> <83h7fxfft0.fsf@gnu.org> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Kisaragi Hiu Message-ID: <54d5e013-aeff-ef7b-ad9e-e4c8dfa72d37@kisaragi-hiu.com> Date: Wed, 11 Aug 2021 03:51:22 +0900 MIME-Version: 1.0 In-Reply-To: <83h7fxfft0.fsf@gnu.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: mail@kisaragi-hiu.com X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 49982 Cc: 49982@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Thank you for the response! Let me try to add some clarifications (that hopefully don't sound too harsh): > First, yours is an unusual use case, I think: when Hunspell is > installed, the dictionary that corresponds to the locale is always > installed, because otherwise Hunspell will not work reliably from the > shell command line. I'm fairly certain my use case isn't unusual. There are no easily installable Hunspell dictionaries for, among other languages: - Any variant of Chinese (Mandarin) - Japanese - Kazakh - Khmer - Malay Every user of any of these languages who tries to set up Hunspell along with ispell.el and Flyspell has to find or invent a poorly documented workaround. - [[https://texwiki.texjp.org/?Hunspell][TeXJP (Japanese) mentions]] "add[ing] the DICTIONARY or WORDLIST environment variables if needed" (「また、必要に応じて環境変数DICTIONARYやWORDLISTを指定しておきます。」) - [[https://home.hirosaki-u.ac.jp/heroic-2020/1575/][Hirosaki University Information Technology Center PC lab's tutorial to spellchecking in Emacs]] sets DICTIONARY to en_US - 200ok.ch (developer of Organice)'s [[https://200ok.ch/posts/2020-08-22_setting_up_spell_checking_with_multiple_dictionaries.html][tutorial for using multiple dictionaries for Hunspell + ispell.el]] mentions ;; Configure `LANG`, otherwise ispell.el cannot find a 'default ;; dictionary' even though multiple dictionaries will be configured ;; in next line. (setenv "LANG" "en_US.UTF-8") - [[http://blog.binchen.org/posts/what-s-the-best-spell-check-set-up-in-emacs/][Chen Bin's blog post on setting up spell check]] uses this block: ;; find aspell and hunspell automatically (cond ;; try hunspell at first ;; if hunspell does NOT exist, use aspell ((executable-find "hunspell") (setq ispell-program-name "hunspell") (setq ispell-local-dictionary "en_US") (setq ispell-local-dictionary-alist ;; Please note the list `("-d" "en_US")` contains ACTUAL parameters passed to hunspell ;; You could use `("-d" "en_US,en_US-med")` to check with multiple dictionaries '(("en_US" "[[:alpha:]]" "[^[:alpha:]]" "[']" nil ("-d" "en_US") nil utf-8))) ;; new variable `ispell-hunspell-dictionary-alist' is defined in Emacs ;; If it's nil, Emacs tries to automatically set up the dictionaries. (when (boundp 'ispell-hunspell-dictionary-alist) (setq ispell-hunspell-dictionary-alist ispell-local-dictionary-alist))) "Emacs tries to automatically set up the dictionaries" refers to ispell-set-spellchecker-params running ispell-find-hunspell-dictionaries after seeing that ispell-hunspell-dictionary-alist is nil. My use case is not unusual. Fixing this bug would eliminate the need for these workarounds. (From the command line you just pass in -d yourself. Setting environment variables is also a native way of configuring programs in the CLI; in Emacs generally wrapper packages like ispell.el define user options instead of asking users to do `setenv` themselves.) > And second, relying on the non-nil value of > ispell-dictionary is fragile: the value could be a remnant from some > previous invocation or from an unsuccessful customization that has > nothing to do with the user's choice or his/her current intent. ispell-dictionary is a user option, not an internal variable. Nothing in ispell.el changes ispell-dictionary besides the command to help the user change the preferred dictionary, `ispell-change-dictionary`, so the value cannot be a remnant from a previous invocation. Without doing anything, ispell-dictionary being nil signals to ispell.el to use the spell checker's default, as evident from its Custom type: (defcustom ispell-dictionary nil "Default dictionary to use if `ispell-local-dictionary' is nil." :type '(choice string (const :tag "default" nil)) :group 'ispell) In fact, the user can set ispell-dictionary in their init.el when they're using aspell and have it work as expected. That's why I consider this a bug. > Moreover, if you manually set ispell-dictionary, then what would be > the purpose of calling ispell-find-hunspell-dictionaries at all? I don't call ispell-find-hunspell-dictionaries myself --- turning on flyspell eventually calls it. The error actually occurs when flyspell-mode-on calls ispell-set-spellchecker-params, which in turn calls ispell-find-hunspell-dictionaries to set up internal variables. This is how Chen Bin's workaround works: it sets ispell-local-dictionary-alist first, then sets ispell-hunspell-dictionary-alist to it, preventing ispell-set-spellchecker-params from triggering the error. ispell-find-hunspell-dictionaries in fact always returns nil, and is only usedfor side effects: setting up - ispell-hunspell-dictionary-alist, - ispell-hunspell-dict-paths-alist, - and ispell-dicts-name2locale-equivs-alist. I'd like to hear more perspectives on this as well. From debbugs-submit-bounces@debbugs.gnu.org Tue Aug 10 15:29:49 2021 Received: (at 49982) by debbugs.gnu.org; 10 Aug 2021 19:29:49 +0000 Received: from localhost ([127.0.0.1]:60846 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mDXRY-0006Db-Us for submit@debbugs.gnu.org; Tue, 10 Aug 2021 15:29:49 -0400 Received: from eggs.gnu.org ([209.51.188.92]:56966) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mDXRT-0006DH-QS for 49982@debbugs.gnu.org; Tue, 10 Aug 2021 15:29:44 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:33674) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mDXRO-0004kd-7x; Tue, 10 Aug 2021 15:29:34 -0400 Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:2958 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mDXRN-00015q-QV; Tue, 10 Aug 2021 15:29:34 -0400 Date: Tue, 10 Aug 2021 22:29:43 +0300 Message-Id: <834kbxf68o.fsf@gnu.org> From: Eli Zaretskii To: Kisaragi Hiu In-Reply-To: <54d5e013-aeff-ef7b-ad9e-e4c8dfa72d37@kisaragi-hiu.com> (message from Kisaragi Hiu on Wed, 11 Aug 2021 03:51:22 +0900) Subject: Re: bug#49982: 27.2; ispell.el fails to find a Hunspell dictionary to use as default despite ispell-dictionary being set References: <59517c95-6568-f646-7097-c601cc9657c9@kisaragi-hiu.com> <83h7fxfft0.fsf@gnu.org> <54d5e013-aeff-ef7b-ad9e-e4c8dfa72d37@kisaragi-hiu.com> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 49982 Cc: 49982@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Kisaragi Hiu > Cc: 49982@debbugs.gnu.org > Date: Wed, 11 Aug 2021 03:51:22 +0900 > > Thank you for the response! Let me try to add some clarifications (that > hopefully don't sound too harsh): > > > First, yours is an unusual use case, I think: when Hunspell is > > installed, the dictionary that corresponds to the locale is always > > installed, because otherwise Hunspell will not work reliably from the > > shell command line. > > I'm fairly certain my use case isn't unusual. > > There are no easily installable Hunspell dictionaries for, among other > languages: > > - Any variant of Chinese (Mandarin) > - Japanese > - Kazakh > - Khmer > - Malay > > Every user of any of these languages who tries to set up Hunspell > along with ispell.el and Flyspell has to find or invent a poorly > documented workaround. > > - [[https://texwiki.texjp.org/?Hunspell][TeXJP (Japanese) mentions]] > "add[ing] the DICTIONARY or WORDLIST environment variables if needed" > (「また、必要に応じて環境変数DICTIONARYやWORDLISTを指定しておきます。」) > - [[https://home.hirosaki-u.ac.jp/heroic-2020/1575/][Hirosaki University > Information Technology Center PC lab's tutorial to spellchecking in > Emacs]] sets DICTIONARY to en_US > - 200ok.ch (developer of Organice)'s > [[https://200ok.ch/posts/2020-08-22_setting_up_spell_checking_with_multiple_dictionaries.html][tutorial > for using multiple dictionaries for Hunspell + ispell.el]] mentions Indeed, defining DICTIONARY in the environment is the way to control the default dictionary. It is documented in the Hunspell's man page. Why cannot it be the solution for when no Hunspell dictionary could be found that matches the locale? Using $DICTIONARY should solve your problem both inside Emacs and outside it. From debbugs-submit-bounces@debbugs.gnu.org Wed Aug 11 07:17:36 2021 Received: (at 49982) by debbugs.gnu.org; 11 Aug 2021 11:17:36 +0000 Received: from localhost ([127.0.0.1]:33586 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mDmEm-0002Yt-IF for submit@debbugs.gnu.org; Wed, 11 Aug 2021 07:17:36 -0400 Received: from out2.migadu.com ([188.165.223.204]:29353) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mDmEg-0002UR-G6 for 49982@debbugs.gnu.org; Wed, 11 Aug 2021 07:17:31 -0400 Subject: Re: bug#49982: 27.2; ispell.el fails to find a Hunspell dictionary to use as default despite ispell-dictionary being set DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kisaragi-hiu.com; s=key1; t=1628680644; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7WKkXF4wZ1bop/67Rq+6Mn/BzyLRSXavXpS3WWlLguI=; b=ZTBhry0T//IclLIdNqLS2VJUbJrfRWTrMkT0/i8jYr26Aw6GhWLQEBvr+lQR3vB53il1Hw zjQjfLevaDXLG4aX7NyaTVuU6I2mzK1ibyN/92CC1rx0NjaAragH0vZrqvv/ADKUvYCDSX AK7jmcGgvcAyy0wLukEhwo/lRANBvyXPsqxAO3Ptk+Zj5EBRTxRaCtvNZLf2Y8ffvcVMTw m4oLBZoskdWZEZ6vjbQ/6Zdtvur7Rz/zA1H+QrmFBLbWfgLdQu8m2MXKKDnvbnvDIWUv4j HeubxnGWQSd0JuNUuLBqaP00AZL5+C3heft6Qc5QG/tQFZHMKjjtM8LLpvbqiA== To: Eli Zaretskii References: <59517c95-6568-f646-7097-c601cc9657c9@kisaragi-hiu.com> <83h7fxfft0.fsf@gnu.org> <54d5e013-aeff-ef7b-ad9e-e4c8dfa72d37@kisaragi-hiu.com> <834kbxf68o.fsf@gnu.org> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Kisaragi Hiu Message-ID: Date: Wed, 11 Aug 2021 20:17:20 +0900 MIME-Version: 1.0 In-Reply-To: <834kbxf68o.fsf@gnu.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: mail@kisaragi-hiu.com X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 49982 Cc: 49982@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) > Indeed, defining DICTIONARY in the environment is the way to control the default dictionary. It is documented in the Hunspell's man page. Why cannot it be the solution for when no Hunspell dictionary could be found that matches the locale? Using $DICTIONARY should solve your problem both inside Emacs and outside it. I don't know, maybe I'm biased here. Hunspell has its quirks, but isn't it ispell.el's job to work around quirks in spellcheckers, and not the end user's? ispell.el worked around Hunspell 1.7's new output quirk. Why can't it work around this quirk? *My* problem is already solved by using the workaround. The bug is that nobody should have to use the workaround. Using environment variables to configure subprocesses is always something that a user can do, but, as you know, there's a reason why ispell.el exposes spellchecker options through Emacs user options. Besides, which dictionary one specifies in `DICTIONARY` doesn't actually matter, it just needs to be one that exists, as it will be overridden by ispell-dictionary when ispell.el actually starts spellchecking. You can do (in emacs -Q): (setenv "LANG" "ja_JP") ; trigger the quirk (setenv "DICTIONARY" "en_US") ; tame ispell-find-hunspell-dictionaries (setq ispell-program (executable-find "hunspell") ispell-dictionary "en_GB") (flyspell-mode) and see that it's spellchecking color to colour. (Try typing "color" then running M-x flyspell-auto-correct-previous-word) --- ispell-dictionary is ispell.el's way of specifying the main dictionary. The manual: > Spell-checkers look up spelling in two dictionaries: the standard dictionary and your personal dictionary. The standard dictionary is specified by the variable ‘ispell-local-dictionary’ or, if that is ‘nil’, by the variable ‘ispell-dictionary’. If both are ‘nil’, the spelling program’s default dictionary is used. The spelling program's default should only ever have an effect when both ispell-local-dictionary and ispell-dictionary is nil. From debbugs-submit-bounces@debbugs.gnu.org Wed Aug 11 08:12:35 2021 Received: (at 49982) by debbugs.gnu.org; 11 Aug 2021 12:12:35 +0000 Received: from localhost ([127.0.0.1]:33722 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mDn63-0000GK-AT for submit@debbugs.gnu.org; Wed, 11 Aug 2021 08:12:35 -0400 Received: from eggs.gnu.org ([209.51.188.92]:46880) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mDn62-0000G9-1a for 49982@debbugs.gnu.org; Wed, 11 Aug 2021 08:12:34 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:56362) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mDn5w-00073i-2a; Wed, 11 Aug 2021 08:12:28 -0400 Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:4834 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mDn5v-0005Ko-Lv; Wed, 11 Aug 2021 08:12:27 -0400 Date: Wed, 11 Aug 2021 15:12:40 +0300 Message-Id: <83r1f0dvt3.fsf@gnu.org> From: Eli Zaretskii To: Kisaragi Hiu In-Reply-To: (message from Kisaragi Hiu on Wed, 11 Aug 2021 20:17:20 +0900) Subject: Re: bug#49982: 27.2; ispell.el fails to find a Hunspell dictionary to use as default despite ispell-dictionary being set References: <59517c95-6568-f646-7097-c601cc9657c9@kisaragi-hiu.com> <83h7fxfft0.fsf@gnu.org> <54d5e013-aeff-ef7b-ad9e-e4c8dfa72d37@kisaragi-hiu.com> <834kbxf68o.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 49982 Cc: 49982@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Kisaragi Hiu > Cc: 49982@debbugs.gnu.org > Date: Wed, 11 Aug 2021 20:17:20 +0900 > > > Indeed, defining DICTIONARY in the environment is the way to control > the default dictionary. It is documented in the Hunspell's man page. > Why cannot it be the solution for when no Hunspell dictionary could be > found that matches the locale? Using $DICTIONARY should solve your > problem both inside Emacs and outside it. > > I don't know, maybe I'm biased here. Hunspell has its quirks, but isn't > it ispell.el's job to work around quirks in spellcheckers, and not the > end user's? Not when the spell-checker is basically not configured correctly. > ispell.el worked around Hunspell 1.7's new output quirk. That was something users could do nothing on their end to solve. > Using environment variables to configure subprocesses is always > something that a user can do, but, as you know, there's a reason why > ispell.el exposes spellchecker options through Emacs user options. That's not what I meant. I meant to suggest that you set DICTIONARY in the init files of your interactive shell, so that it would allow you to use Hunspell both inside Emacs (because Emacs inherits the environment variables of its parent shell) and outside Emacs. I didn't mean to suggest that you (or others) should inject DICTIONARY into the environment of the Hunspell sub-process by doing something in Emacs, like setenv etc. > Besides, which dictionary one specifies in `DICTIONARY` doesn't actually > matter, it just needs to be one that exists, as it will be overridden by > ispell-dictionary when ispell.el actually starts spellchecking. It should be the dictionary you want to use by default. In your case, I assume it's en_US. From debbugs-submit-bounces@debbugs.gnu.org Mon Aug 22 08:58:14 2022 Received: (at 49982) by debbugs.gnu.org; 22 Aug 2022 12:58:14 +0000 Received: from localhost ([127.0.0.1]:38289 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oQ70Q-0005L6-GT for submit@debbugs.gnu.org; Mon, 22 Aug 2022 08:58:14 -0400 Received: from quimby.gnus.org ([95.216.78.240]:54042) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oQ70L-0005Kf-Nz for 49982@debbugs.gnu.org; Mon, 22 Aug 2022 08:58:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:Date:References: In-Reply-To:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=TOVlF/U5xb626ZRiG4Fr22bKZ6ZL4DGtCR0OsvSmk9Y=; b=rwOnDOCIldr2v6Am6fH7A1tUep tFnr0n3M70m0BsTh2LPD7LfcrnI1WQQoV0YfM4zT62PMGam/fyZPktJQiOpXXbdkNoxw/2nVBp6C3 enUzUlGdCB26C8Tg/Ibxs+LmJWd/KHSz3k+C0SbAJyCHch4Ayo1fVc8+pTyUm5+VjfIU=; Received: from [84.212.220.105] (helo=joga) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oQ70C-0005az-9P; Mon, 22 Aug 2022 14:58:02 +0200 From: Lars Ingebrigtsen To: Kisaragi Hiu Subject: Re: bug#49982: 27.2; ispell.el fails to find a Hunspell dictionary to use as default despite ispell-dictionary being set In-Reply-To: <59517c95-6568-f646-7097-c601cc9657c9@kisaragi-hiu.com> (Kisaragi Hiu's message of "Wed, 11 Aug 2021 00:12:06 +0900") References: <59517c95-6568-f646-7097-c601cc9657c9@kisaragi-hiu.com> X-Now-Playing: 13 & God's _Own Your Ghost_: "Oldage" Date: Mon, 22 Aug 2022 14:57:59 +0200 Message-ID: <871qt877vs.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Kisaragi Hiu writes: > 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-dictiona [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 49982 Cc: 49982@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Kisaragi Hiu writes: > 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. I've now fixed this in Emacs 29 (by first using our current rules, and then trying again with -d ispell-dictionary). From debbugs-submit-bounces@debbugs.gnu.org Mon Aug 22 08:58:20 2022 Received: (at control) by debbugs.gnu.org; 22 Aug 2022 12:58:20 +0000 Received: from localhost ([127.0.0.1]:38291 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oQ70V-0005LL-S6 for submit@debbugs.gnu.org; Mon, 22 Aug 2022 08:58:20 -0400 Received: from quimby.gnus.org ([95.216.78.240]:54056) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oQ70O-0005Kn-MM for control@debbugs.gnu.org; Mon, 22 Aug 2022 08:58:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Subject:From:To:Message-Id:Date:Sender:Reply-To:Cc: MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=IT9hRXBOdmKBKCY40p16ZCA6MDN5XttmncDzJwiWrjk=; b=i99kxd1wnO+txhuxvYZSAt/m4+ woKYuLi4nnYaqQSt8ZaOkQqzarNNAc6X+gmgvS8fYazwhvDxz1DjJV8u3YXvkGS/cHnzkM7nU6VCB ZspmGG1y26HTcN6Bv9ZnecmSyJtuW1A3uJ2/1OMS2BOTwFjtEW80oEAw+0+cTKUES8Sw=; Received: from [84.212.220.105] (helo=joga) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oQ70G-0005bA-RI for control@debbugs.gnu.org; Mon, 22 Aug 2022 14:58:06 +0200 Date: Mon, 22 Aug 2022 14:58:04 +0200 Message-Id: <87zgfw5tb7.fsf@gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #49982 X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: close 49982 29.1 quit Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) close 49982 29.1 quit From unknown Sun Jun 22 00:52:51 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Tue, 20 Sep 2022 11:24:12 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator