unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Tak Kunihiro <tkk@misasa.okayama-u.ac.jp>
To: help-gnu-emacs@gnu.org, eliz@gnu.org
Cc: tkk@misasa.okayama-u.ac.jp
Subject: Re: Hunspell for Japanese
Date: Sun, 18 Feb 2018 14:31:56 +0900 (JST)	[thread overview]
Message-ID: <20180218.143156.2077820890057474242.tkk@misasa.okayama-u.ac.jp> (raw)
In-Reply-To: <2D3482A4-0F9A-4D09-86C2-958AB03FA388@misasa.okayama-u.ac.jp>

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
does.

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
solution.

  (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?



  parent reply	other threads:[~2018-02-18  5:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-17 13:53 Hunspell for Japanese Tak Kunihiro
2018-02-17 15:18 ` Eli Zaretskii
2018-02-18  5:31 ` Tak Kunihiro [this message]
2018-02-18 15:59   ` Eli Zaretskii
2018-02-24  1:41   ` Tak Kunihiro

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=20180218.143156.2077820890057474242.tkk@misasa.okayama-u.ac.jp \
    --to=tkk@misasa.okayama-u.ac.jp \
    --cc=eliz@gnu.org \
    --cc=help-gnu-emacs@gnu.org \
    /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.
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).