Subject: bug#25230: Patch to ispell.el to simplify use of [:alpha:] for CASECHARS in built-in dictionaries

From: Reuben Thomas <[email-masked]>
Date: Wed, 21 Dec 2016 00:20:27 +0000

Here's an updated patch, which simply removes the overriding of the
built-in CASECHARS/NOT-CASECHARS settings for ispell dictionaries. It
assumes that all other dictionaries (either configured by the user or found
by the various auto-scanning functions) will have sensible
CASECHARS/NOT-CASECHARS values, which is expected to be the case at present.
From 00b66a9599cf65e2188dd590d256c301e978c6a2 Mon Sep 17 00:00:00 2001
From: Reuben Thomas <[email-masked]>
Date: Mon, 19 Dec 2016 12:17:44 +0000
Subject: [PATCH 1/6] Keep default CASECHARS/NOT-CASECHARS for ispell built-in
 dictionaries

* lisp/textmodes/ispell.el (ispell-set-spellchecker-params): Do not
override CASECHARS and NOT-CASECHARS.  The ispell dictionaries
retain their hardwired values, and all other dictionaries are given
sensible defaults.
---
 lisp/textmodes/ispell.el | 112 ++++++++++++++---------------------------------
 1 file changed, 34 insertions(+), 78 deletions(-)

diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index 23ee412..82e5c2b 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -436,114 +436,70 @@ ispell-dictionary-base-alist
      ;; The default dictionary.  It may be English.aff, or any other
      ;; dictionary depending on locale and such things.  We should probably
      ;; ask ispell what dictionary it's using, but until we do that, let's
-     ;; just use a minimal regexp. [:alpha:] will later be set if possible.
-     "[A-Za-z]" "[^A-Za-z]" "[']" nil ("-B") nil iso-8859-1)
+     ;; just use a minimal regexp.
+     "[[:alpha:]]" "[^[:alpha:]]" "[']" nil ("-B") nil iso-8859-1)
     ("american"				; Yankee English
-     "[A-Za-z]" "[^A-Za-z]" "[']" nil ("-B") nil iso-8859-1)
+     "[[:alpha:]]" "[^[:alpha:]]" "[']" nil ("-B") nil iso-8859-1)
     ("brasileiro"			; Brazilian mode
-     "[A-Z\301\311\315\323\332\300\310\314\322\331\303\325\307\334\302\312\324a-z\341\351\355\363\372\340\350\354\362\371\343\365\347\374\342\352\364]"
-     "[^A-Z\301\311\315\323\332\300\310\314\322\331\303\325\307\334\302\312\324a-z\341\351\355\363\372\340\350\354\362\371\343\365\347\374\342\352\364]"
-     "[']" nil nil nil iso-8859-1)
+     "[[:alpha:]]" "[^[:alpha:]]" "[']" nil nil nil iso-8859-1)
     ("british"				; British version
-     "[A-Za-z]" "[^A-Za-z]" "[']" nil ("-B") nil iso-8859-1)
+     "[[:alpha:]]" "[^[:alpha:]]" "[']" nil ("-B") nil iso-8859-1)
     ("castellano"			; Spanish mode
-     "[A-Z\301\311\315\321\323\332\334a-z\341\351\355\361\363\372\374]"
-     "[^A-Z\301\311\315\321\323\332\334a-z\341\351\355\361\363\372\374]"
-     "[-]" nil ("-B") "~tex" iso-8859-1)
+     "[[:alpha:]]" "[^[:alpha:]]" "[-]" nil ("-B") "~tex" iso-8859-1)
     ("castellano8"			; 8 bit Spanish mode
-     "[A-Z\301\311\315\321\323\332\334a-z\341\351\355\361\363\372\374]"
-     "[^A-Z\301\311\315\321\323\332\334a-z\341\351\355\361\363\372\374]"
-     "[-]" nil ("-B" "-d" "castellano") "~latin1" iso-8859-1)
+     "[[:alpha:]]" "[^[:alpha:]]" "[-]" nil ("-B" "-d" "castellano") "~latin1" iso-8859-1)
     ("czech"
-     "[A-Za-z\301\311\314\315\323\332\331\335\256\251\310\330\317\253\322\341\351\354\355\363\372\371\375\276\271\350\370\357\273\362]"
-     "[^A-Za-z\301\311\314\315\323\332\331\335\256\251\310\330\317\253\322\341\351\354\355\363\372\371\375\276\271\350\370\357\273\362]"
-     "" nil ("-B") nil iso-8859-2)
+     "[[:alpha:]]" "[^[:alpha:]]" "" nil ("-B") nil iso-8859-2)
     ("dansk"				; Dansk.aff
-     "[A-Z\306\330\305a-z\346\370\345]" "[^A-Z\306\330\305a-z\346\370\345]"
-     "[']" nil ("-C") nil iso-8859-1)
+     "[[:alpha:]]" "[^[:alpha:]]" "[']" nil ("-C") nil iso-8859-1)
     ("deutsch"				; Deutsch.aff
-     "[a-zA-Z\"]" "[^a-zA-Z\"]" "[']" t ("-C") "~tex" iso-8859-1)
+     "[[:alpha:]]" "[^[:alpha:]]" "[']" t ("-C") "~tex" iso-8859-1)
     ("deutsch8"
-     "[a-zA-Z\304\326\334\344\366\337\374]"
-     "[^a-zA-Z\304\326\334\344\366\337\374]"
-     "[']" t ("-C" "-d" "deutsch") "~latin1" iso-8859-1)
+     "[[:alpha:]]" "[^[:alpha:]]" "[']" t ("-C" "-d" "deutsch") "~latin1" iso-8859-1)
     ("english"				; make English explicitly selectable
-     "[A-Za-z]" "[^A-Za-z]" "[']" nil ("-B") nil iso-8859-1)
+     "[[:alpha:]]" "[^[:alpha:]]" "[']" nil ("-B") nil iso-8859-1)
     ("esperanto"
-     "[A-Za-z\246\254\266\274\306\330\335\336\346\370\375\376]"
-     "[^A-Za-z\246\254\266\274\306\330\335\336\346\370\375\376]"
-     "[-']" t ("-C") "~latin3" iso-8859-3)
+     "[[:alpha:]]" "[^[:alpha:]]" "[-']" t ("-C") "~latin3" iso-8859-3)
     ("esperanto-tex"
-     "[A-Za-z^\\]" "[^A-Za-z^\\]"
-     "[-'`\"]" t ("-C" "-d" "esperanto") "~tex" iso-8859-3)
+     "[[:alpha:]]" "[^[:alpha:]]" "[-'`\"]" t ("-C" "-d" "esperanto") "~tex" iso-8859-3)
     ("finnish"
-     "[A-Za-z\345\344\366\305\304\326]"
-     "[^A-Za-z\345\344\366\305\304\326]"
-     "[:]" nil ("-C") "~list" iso-8859-1)
+     "[[:alpha:]]" "[^[:alpha:]]" "[:]" nil ("-C") "~list" iso-8859-1)
     ("francais7"
-     "[A-Za-z]" "[^A-Za-z]" "[`'^-]" t nil nil iso-8859-1)
+     "[[:alpha:]]" "[^[:alpha:]]" "[`'^-]" t nil nil iso-8859-1)
     ("francais"				; Francais.aff
-     "[A-Za-z\300\302\306\307\310\311\312\313\316\317\324\331\333\334\340\342\347\350\351\352\353\356\357\364\371\373\374]"
-     "[^A-Za-z\300\302\306\307\310\311\312\313\316\317\324\331\333\334\340\342\347\350\351\352\353\356\357\364\371\373\374]"
-     "[-'.@]" t nil "~list" iso-8859-1)
+     "[[:alpha:]]" "[^[:alpha:]]" "[-'.@]" t nil "~list" iso-8859-1)
     ("francais-tex"			; Francais.aff
-     "[A-Za-z\300\302\306\307\310\311\312\313\316\317\324\331\333\334\340\342\347\350\351\352\353\356\357\364\371\373\374\\]"
-     "[^A-Za-z\300\302\306\307\310\311\312\313\316\317\324\331\333\334\340\342\347\350\351\352\353\356\357\364\371\373\374\\]"
-     "[-'^`\".@]" t nil "~tex" iso-8859-1)
+     "[[:alpha:]]" "[^[:alpha:]]" "[-'^`\".@]" t nil "~tex" iso-8859-1)
     ("german"				; german.aff
-     "[a-zA-Z\"]" "[^a-zA-Z\"]" "[']" t ("-C") "~tex" iso-8859-1)
+     "[[:alpha:]]" "[^[:alpha:]]" "[']" t ("-C") "~tex" iso-8859-1)
     ("german8"				; german.aff
-     "[a-zA-Z\304\326\334\344\366\337\374]"
-     "[^a-zA-Z\304\326\334\344\366\337\374]"
-     "[']" t ("-C" "-d" "german") "~latin1" iso-8859-1)
+     "[[:alpha:]]" "[^[:alpha:]]" "[']" t ("-C" "-d" "german") "~latin1" iso-8859-1)
     ("italiano"				; Italian.aff
-     "[A-Z\300\301\310\311\314\315\322\323\331\332a-z\340\341\350\351\354\355\363\371\372]"
-     "[^A-Z\300\301\310\311\314\315\322\323\331\332a-z\340\341\350\351\354\355\363\371\372]"
-     "[-.]" nil ("-B" "-d" "italian") "~tex" iso-8859-1)
+     "[[:alpha:]]" "[^[:alpha:]]" "[-.]" nil ("-B" "-d" "italian") "~tex" iso-8859-1)
     ("nederlands"			; Nederlands.aff
-     "[A-Za-z\300\301\302\303\304\305\307\310\311\312\313\314\315\316\317\322\323\324\325\326\331\332\333\334\340\341\342\343\344\345\347\350\351\352\353\354\355\356\357\361\362\363\364\365\366\371\372\373\374]"
-     "[^A-Za-z\300\301\302\303\304\305\307\310\311\312\313\314\315\316\317\322\323\324\325\326\331\332\333\334\340\341\342\343\344\345\347\350\351\352\353\354\355\356\357\361\362\363\364\365\366\371\372\373\374]"
-     "[']" t ("-C") nil iso-8859-1)
+     "[[:alpha:]]" "[^[:alpha:]]" "[']" t ("-C") nil iso-8859-1)
     ("nederlands8"			; Dutch8.aff
-     "[A-Za-z\300\301\302\303\304\305\307\310\311\312\313\314\315\316\317\322\323\324\325\326\331\332\333\334\340\341\342\343\344\345\347\350\351\352\353\354\355\356\357\361\362\363\364\365\366\371\372\373\374]"
-     "[^A-Za-z\300\301\302\303\304\305\307\310\311\312\313\314\315\316\317\322\323\324\325\326\331\332\333\334\340\341\342\343\344\345\347\350\351\352\353\354\355\356\357\361\362\363\364\365\366\371\372\373\374]"
-     "[']" t ("-C") nil iso-8859-1)
+     "[[:alpha:]]" "[^[:alpha:]]" "[']" t ("-C") nil iso-8859-1)
     ("norsk"				; 8 bit Norwegian mode
-     "[A-Za-z\305\306\307\310\311\322\324\330\345\346\347\350\351\362\364\370]"
-     "[^A-Za-z\305\306\307\310\311\322\324\330\345\346\347\350\351\362\364\370]"
-     "[\"]" nil nil "~list" iso-8859-1)
+     "[[:alpha:]]" "[^[:alpha:]]" "[\"]" nil nil "~list" iso-8859-1)
     ("norsk7-tex"			; 7 bit Norwegian TeX mode
-     "[A-Za-z{}\\'^`]" "[^A-Za-z{}\\'^`]"
-     "[\"]" nil ("-d" "norsk") "~plaintex" iso-8859-1)
+     "[[:alpha:]]" "[^[:alpha:]]" "[\"]" nil ("-d" "norsk") "~plaintex" iso-8859-1)
     ("polish"				; Polish mode
-     "[A-Za-z\241\243\246\254\257\261\263\266\274\277\306\312\321\323\346\352\361\363]"
-     "[^A-Za-z\241\243\246\254\257\261\263\266\274\277\306\312\321\323\346\352\361\363]"
-     "[.]" nil nil nil iso-8859-2)
+     "[[:alpha:]]" "[^[:alpha:]]" "[.]" nil nil nil iso-8859-2)
     ("portugues"                        ; Portuguese mode
-     "[a-zA-Z\301\302\307\311\323\340\341\342\351\352\355\363\343\347\372]"
-     "[^a-zA-Z\301\302\307\311\323\340\341\342\351\352\355\363\343\347\372]"
-     "[']" t ("-C") "~latin1" iso-8859-1)
+     "[[:alpha:]]" "[^[:alpha:]]" "[']" t ("-C") "~latin1" iso-8859-1)
     ("russian"				; Russian.aff (KOI8-R charset)
-     "[\341\342\367\347\344\345\263\366\372\351\352\353\354\355\356\357\360\362\363\364\365\346\350\343\376\373\375\370\371\377\374\340\361\301\302\327\307\304\305\243\326\332\311\312\313\314\315\316\317\320\322\323\324\325\306\310\303\336\333\335\330\331\337\334\300\321]"
-     "[^\341\342\367\347\344\345\263\366\372\351\352\353\354\355\356\357\360\362\363\364\365\346\350\343\376\373\375\370\371\377\374\340\361\301\302\327\307\304\305\243\326\332\311\312\313\314\315\316\317\320\322\323\324\325\306\310\303\336\333\335\330\331\337\334\300\321]"
-     "" nil nil nil koi8-r)
+     "[[:alpha:]]" "[^[:alpha:]]" "" nil nil nil koi8-r)
     ("russianw"				; russianw.aff (CP1251 charset)
-     "[\300\301\302\303\304\305\250\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\334\333\332\335\336\337\340\341\342\343\344\345\270\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\374\373\372\375\376\377]"
-     "[^\300\301\302\303\304\305\250\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\334\333\332\335\336\337\340\341\342\343\344\345\270\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\374\373\372\375\376\377]"
-     "" nil nil nil windows-1251)
+     "[[:alpha:]]" "[^[:alpha:]]" "" nil nil nil windows-1251)
     ("slovak"				; Slovakian
-     "[A-Za-z\301\304\311\315\323\332\324\300\305\245\335\256\251\310\317\253\322\341\344\351\355\363\372\364\340\345\265\375\276\271\350\357\273\362]"
-     "[^A-Za-z\301\304\311\315\323\332\324\300\305\245\335\256\251\310\317\253\322\341\344\351\355\363\372\364\340\345\265\375\276\271\350\357\273\362]"
-     "" nil ("-B") nil iso-8859-2)
+     "[[:alpha:]]" "[^[:alpha:]]" "" nil ("-B") nil iso-8859-2)
     ("slovenian"                        ; Slovenian
-     "[A-Za-z\301\304\311\315\323\332\324\300\305\245\335\256\251\310\317\253\322\341\344\351\355\363\372\364\340\345\265\375\276\271\350\357\273\362]"
-     "[^A-Za-z\301\304\311\315\323\332\324\300\305\245\335\256\251\310\317\253\322\341\344\351\355\363\372\364\340\345\265\375\276\271\350\357\273\362]"
-     "" nil ("-B" "-d" "slovenian") nil iso-8859-2)
+     "[[:alpha:]]" "[^[:alpha:]]" "" nil ("-B" "-d" "slovenian") nil iso-8859-2)
     ("svenska"				; Swedish mode
-     "[A-Za-z\345\344\366\351\340\374\350\346\370\347\305\304\326\311\300\334\310\306\330\307]"
-     "[^A-Za-z\345\344\366\351\340\374\350\346\370\347\305\304\326\311\300\334\310\306\330\307]"
-     "[']" nil ("-C") "~list" iso-8859-1)
-    ("hebrew" "[\340\341\342\343\344\345\346\347\350\351\353\352\354\356\355\360\357\361\362\364\363\367\366\365\370\371\372]" "[^\340\341\342\343\344\345\346\347\350\351\353\352\354\356\355\360\357\361\362\364\363\367\366\365\370\371\372]" "" nil ("-B") nil cp1255))
+     "[[:alpha:]]" "[^[:alpha:]]" "[']" nil ("-C") "~list" iso-8859-1)
+    ("hebrew"
+     "[[:alpha:]]" "[^[:alpha:]]" "" nil ("-B") nil cp1255))
   "Base value for `ispell-dictionary-alist'.")
 
 (defvar ispell-dictionary-alist nil
-- 
2.7.4