unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#25230: Patch to ispell.el to simplify use of [:alpha:] for CASECHARS in built-in dictionaries
@ 2016-12-19 12:28 Reuben Thomas
  2016-12-19 16:23 ` Eli Zaretskii
  0 siblings, 1 reply; 13+ messages in thread
From: Reuben Thomas @ 2016-12-19 12:28 UTC (permalink / raw)
  To: 25230


[-- Attachment #1.1: Type: text/plain, Size: 703 bytes --]

I noticed that I had not quite finished the work of commit 854ed8a, which
removed the test for support for POSIX character classes, as that is now
guaranteed.

In ispell-set-spellchecker-params, there is code that used to be run
conditionally on support for POSIX character classes, which sets all the
CASECHARS and NOT-CASECHARS entries for built-in dictionaries to
[[:alpha:]] and [^[:alpha:]] respectively.

There is no point doing this unconditionally, so instead, put these
character classes directly into the initial values used in
ispell-dictionary-base-alist. This change also makes the variable's
initialization easier to read.

The attached patch makes these changes.

-- 
http://rrt.sc3d.org

[-- Attachment #1.2: Type: text/html, Size: 1270 bytes --]

[-- Attachment #2: 0001-Use-alpha-by-default-for-ispell-built-in-dictionarie.patch --]
[-- Type: text/x-patch, Size: 12545 bytes --]

From 73101807ff3abd052b137fb8f881953b9beaa4a7 Mon Sep 17 00:00:00 2001
From: Reuben Thomas <rrt@sc3d.org>
Date: Mon, 19 Dec 2016 12:17:44 +0000
Subject: [PATCH 1/4] Use [:alpha:] by default for ispell built-in dictionaries

* lisp/textmodes/ispell.el (ispell-dictionary-base-alist)
(ispell-set-spellchecker-params): Since Emacs is now guaranteed to
support named character classes in regexps, use `[:alpha:]' directly
in ispell-dictionary-base-alist rather than setting it in
ispell-set-spellchecker-params.  (This used to be done conditionally
until commit 854ed8a, of which this patch is a logical completion.)
---
 lisp/textmodes/ispell.el | 116 +++++++++++++++--------------------------------
 1 file changed, 36 insertions(+), 80 deletions(-)

diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index 23ee412..0aced0c 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
@@ -1290,8 +1246,8 @@ ispell-set-spellchecker-params
         (cl-pushnew (if (cadr adict) ;; Do not touch hunspell uninitialized entries
                         (list
                          (nth 0 adict)   ; dict name
-                         "[[:alpha:]]"   ; casechars
-                         "[^[:alpha:]]"  ; not-casechars
+                         (nth 1 adict)   ; casechars
+                         (nth 2 adict)   ; not-casechars
                          (nth 3 adict)   ; otherchars
                          (nth 4 adict)   ; many-otherchars-p
                          (nth 5 adict)   ; ispell-args
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2019-06-24 23:08 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-19 12:28 bug#25230: Patch to ispell.el to simplify use of [:alpha:] for CASECHARS in built-in dictionaries Reuben Thomas
2016-12-19 16:23 ` Eli Zaretskii
2016-12-19 21:17   ` Reuben Thomas
2016-12-20 15:37     ` Eli Zaretskii
2016-12-20 18:42       ` Reuben Thomas
2016-12-20 19:37         ` Eli Zaretskii
2016-12-20 21:45           ` Reuben Thomas
2016-12-21  0:20             ` Reuben Thomas
2016-12-21 17:15               ` Eli Zaretskii
2016-12-21 17:31                 ` Reuben Thomas
2016-12-21 18:03                   ` Eli Zaretskii
2016-12-21 22:33                     ` Reuben Thomas
2019-06-24 23:08                       ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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