From: Stefan Kangas <stefan@marxist.se>
To: Eli Zaretskii <eliz@gnu.org>
Cc: sw9@outlook.com, 25825@debbugs.gnu.org
Subject: bug#25825: 25.1; ispell-find-hunspell-dictionaries not working on Windows
Date: Wed, 26 Aug 2020 13:01:21 -0700 [thread overview]
Message-ID: <CADwFkm=dNbrjs-70G70VtWtcRe2suy5fRrVdOh6Dj47c9ByZeA@mail.gmail.com> (raw)
In-Reply-To: <CADwFkm=SkzB9XxQUm_AEg+gzn2oCmZa38o+RWsJBYf3Ya9GawA@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 606 bytes --]
Stefan Kangas <stefan@marxist.se> writes:
> It seems to be an issue with my environment. I've been using this for a
> very long time:
>
> $ locale
> LANG=
So, I looked into all my locale stuff again, and it turns out that $LANG
was unintentionally left unset here for boring reasons. (There is no
reason to leave $LANG unset.)
> One idea to improve the situation on our end is to look for "Can't
> open affix or dictionary files for dictionary named 'default'." and
> raise a better error in these cases.
I think it's better to raise the more helpful error.
How does the attached diff look?
[-- Attachment #2: bug-25825-2.diff --]
[-- Type: text/x-diff, Size: 3819 bytes --]
diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index 6eaa0582aa..6e7eb0fb5e 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -1096,28 +1096,38 @@ ispell-find-hunspell-dictionaries
in `ispell-dicts-name2locale-equivs-alist' if an explicit
dictionary from that list was found."
(let ((hunspell-found-dicts
- (split-string
- (with-temp-buffer
- (ispell-call-process ispell-program-name
- null-device
- t
- nil
- "-D"
- ;; Use -a to prevent Hunspell from
- ;; trying to initialize its
- ;; curses/termcap UI, which causes it
- ;; to crash or fail to start in some
- ;; MS-Windows ports.
- "-a"
- ;; Hunspell 1.7.0 (and later?) won't
- ;; show LOADED DICTIONARY unless
- ;; there's at least one file argument
- ;; on the command line. So we feed
- ;; it with the null device.
- null-device)
- (buffer-string))
- "[\n\r]+"
- t))
+ (seq-filter
+ (lambda (str)
+ (when (string-match
+ ;; Hunspell gives this error when there is some
+ ;; installation problem, for example if $LANG is unset.
+ (concat "^Can't open affix or dictionary files "
+ "for dictionary named \"default\".$")
+ str)
+ (user-error "Hunspell error: %s" str))
+ (file-name-absolute-p str))
+ (split-string
+ (with-temp-buffer
+ (ispell-call-process ispell-program-name
+ null-device
+ t
+ nil
+ "-D"
+ ;; Use -a to prevent Hunspell from
+ ;; trying to initialize its
+ ;; curses/termcap UI, which causes it
+ ;; to crash or fail to start in some
+ ;; MS-Windows ports.
+ "-a"
+ ;; Hunspell 1.7.0 (and later?) won't
+ ;; show LOADED DICTIONARY unless
+ ;; there's at least one file argument
+ ;; on the command line. So we feed
+ ;; it with the null device.
+ null-device)
+ (buffer-string))
+ "[\n\r]+"
+ t)))
hunspell-default-dict
hunspell-default-dict-entry
hunspell-multi-dict)
@@ -1164,7 +1174,7 @@ ispell-find-hunspell-dictionaries
(dolist (dict-equiv ispell-dicts-name2locale-equivs-alist)
(let ((dict-equiv-key (car dict-equiv))
(dict-equiv-value (cadr dict-equiv))
- (exclude-aliases (list ;; Exclude TeX aliases
+ (exclude-aliases (list ;; Exclude TeX aliases
"esperanto-tex"
"francais7"
"francais-tex"
@@ -1175,7 +1185,7 @@ ispell-find-hunspell-dictionaries
(let ((affix-file (cadr (assoc dict-equiv-value
ispell-hunspell-dict-paths-alist))))
(ispell-print-if-debug "++ ispell-fhd: Adding alias %s -> %s.\n"
- dict-equiv-key affix-file)
+ dict-equiv-key affix-file)
(cl-pushnew (list dict-equiv-key affix-file)
ispell-hunspell-dict-paths-alist :test #'equal)))))
;; Parse and set values for default dictionary.
next prev parent reply other threads:[~2020-08-26 20:01 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-21 3:41 bug#25825: 25.1; ispell-find-hunspell-dictionaries not working on Windows S W
2020-08-26 18:09 ` Stefan Kangas
2020-08-26 18:28 ` Eli Zaretskii
2020-08-26 18:34 ` Eli Zaretskii
2020-08-27 4:32 ` Stefan Kangas
2020-11-24 8:43 ` Lars Ingebrigtsen
2020-08-26 18:36 ` Eli Zaretskii
2020-08-26 18:48 ` Stefan Kangas
2020-08-26 18:59 ` Eli Zaretskii
2020-08-26 19:21 ` Stefan Kangas
2020-08-26 19:39 ` Eli Zaretskii
2020-08-26 20:10 ` Stefan Kangas
2020-08-26 20:01 ` Stefan Kangas [this message]
2020-08-27 3:27 ` Eli Zaretskii
2020-08-27 3:51 ` Stefan Kangas
2020-08-26 18:48 ` Stefan Kangas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CADwFkm=dNbrjs-70G70VtWtcRe2suy5fRrVdOh6Dj47c9ByZeA@mail.gmail.com' \
--to=stefan@marxist.se \
--cc=25825@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=sw9@outlook.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).