Subject: bug#23097: 24.5; ispell.el: lines with both CASECHARS and NOT-CASECHARS get sent to the spell checker

From: Nikolay Kudryavtsev <[email-masked]>
Date: Wed, 23 Mar 2016 21:11:19 +0300

Each entry ispell-dictionary-alist has elements called CASECHARS and 
NOT-CASECHARS. They are used for defining what gets sent to the spell 
checker and what does not.

One use case for them is that, if you have two dictionaries for 
languages with totally different alphabets, you can spellcheck a file 
where both languages are mixed together. In theory.

Here's what happens in practice:
If line contains only CASECHARS, it gets sent to the spell checker.
If line contains only NOT-CASECHARS, it does not get sent to the spell 
checker.
If line contains both CASECHARS and NOT-CASECHARS, the whole line gets 
sent to the spell checker.

Sending the whole line makes NOT-CASECHARS pretty useless. I think the 
reasonable behavior in this case would be sending the line word by word.

Here's how to repeat this with aspell.
1. Starting from emacs -Q eval this:
(setq ispell-program-name "aspell")
(defun ispell-set-my-dictionaries()
   (setq ispell-dictionary-alist (delq (assoc "english" 
ispell-dictionary-alist) ispell-dictionary-alist))
   (add-to-list 'ispell-dictionary-alist
                '("english" "[kcat]" "[dogh]" "[']" nil ("-B") nil 
iso-8859-1)))
(advice-add 'ispell-set-spellchecker-params :after 
#'ispell-set-my-dictionaries)
2. ispell-change-dictionary to english.
3. ispell-buffer a buffer containing this:
kat
doh
kat doh

"Kat" at the first line would get sent to aspell, since it passes 
CASECHARS. This is fine. "Doh" at the second line would be ignored, 
since it's not in CASECHARS. This is fine too. At the line with both 
words, not only "kat" would get sent, but also "doh" and that's what we 
don't want to happen.

-- 
Best Regards,
Nikolay Kudryavtsev