[Top][All Lists]

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

Re: Hunspell for Japanese

From: Tak Kunihiro
Subject: Re: Hunspell for Japanese
Date: Sun, 18 Feb 2018 14:31:56 +0900 (JST)

Thank you for the reply.

I see.  It is true that I should not expect both Aspell and Hunspell
to handle Japanese correctly when their task is to check English.  It
was just a lucky case how flyspell-mode with Aspell ignores Japanese
words and show no underlines.

> Can you tell why you pay attention to underlines in non-English
> words in this situation?

When I write Japanese, very often English words such for `Emacs' are
mixed.  Thus I (I think most of Japanese) run flyspell-mode with
English dictionary all the time.  I expect flyspell-mode ignores all
Japanese words and only checks English words like how LibreOffice

With flyspell-mode with Hunspell, lines are shown under many Japanese
phrases (not all Japanese phases) and I cannot tell which underline
corresponds to misspelled English words.  As inferred already, Aspell
only shows underline on wrong spelled English.

> But once again, you've set up flyspell-mode to work in English, so you
> shouldn't pay attention to what it does with Japanese.

I agree. I also see problem with M-x ispell-buffer, and noticed a

  (defvar ispell-regexp-non-ascii "[^\000-\377]+"
    "Regular expression to match a non-ascii word.")
  (add-to-list 'ispell-skip-region-alist (list ispell-regexp-non-ascii))

Once I accept this solution for M-x spell-buffer, I would accept a
solution for flyspell-mode as shown below.

  (defun flyspell-skip-non-ascii (beg end info)
    "Tell flyspell to skip a non-ascii word.
  Call this on `flyspell-incorrect-hook'."
    (string-match ispell-regexp-non-ascii (buffer-substring beg end)))
  (add-hook 'flyspell-incorrect-hook 'flyspell-skip-non-ascii)

It took me a while to figure this out.  I think that what M-x
ispell-buffer and flyspell-mode provide is fundamental functionalities
and it is good to be documented in somewhere in Emacs such for (info
"(emacs) Spelling").  Can you give suggestion?

reply via email to

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