emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 587a60c: Signal error on Hunspell installation problem


From: Stefan Kangas
Subject: master 587a60c: Signal error on Hunspell installation problem
Date: Thu, 27 Aug 2020 00:21:45 -0400 (EDT)

branch: master
commit 587a60cc0fb80e7be51707b75bc9e097714a250c
Author: Stefan Kangas <stefankangas@gmail.com>
Commit: Stefan Kangas <stefankangas@gmail.com>

    Signal error on Hunspell installation problem
    
    * lisp/textmodes/ispell.el (ispell-find-hunspell-dictionaries):
    Signal user-error when Hunspell warns that it "Can't open affix or
    dictionary files", and propagate this message.  (Bug#25825)
---
 lisp/textmodes/ispell.el | 54 ++++++++++++++++++++++++++++--------------------
 1 file changed, 32 insertions(+), 22 deletions(-)

diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index 6eaa058..86452ff 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -1096,28 +1096,38 @@ 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
-           (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 (is $LANG unset?): %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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]