[Dict-common-dev] debian ispell.el: adding a new dictionary

Nick Patavalis npat@efault.net
Fri, 12 Mar 2004 17:46:29 +0200


I 've been using "ispell" ("aspell" to be precise) and "ispell.el" for
quite some time. As Greek is my native tongue, and as it is not, by
default, supported by ispell, what I used to do was to copy a fresh
version of the ispell.el script in my "~/lib/emacs/" (which comes
first in the load-path) and apply the following patch (I recently
submitted this to Ken Stevens for inclusion in the next official
ispell.el dists):

######### BEGIN ispell.el PATCH ######################################

--- ispell.el.orig	2004-03-10 23:20:50.000000000 +0200
+++ ispell.el	2004-03-10 23:23:21.000000000 +0200
@@ -672,13 +672,24 @@
     "[^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)))
 
+;;; Seventh part of dictionary, shortened for loaddefs.el
+;;;###autoload
+(setq
+ ispell-dictionary-alist-7
+ '(("greek"                             ; 8 bit Greek Mode
+    "[\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\363\362\364\365\366\367\370\371\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\323\324\325\326\327\330\331\334\335\336\337\374\375\376\266\270\271\272\274\276\277\351\373\332\333\300\340]"
+    "[^\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\363\362\364\365\366\367\370\371\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\323\324\325\326\327\330\331\334\335\336\337\374\375\376\266\270\271\272\274\276\277\351\373\332\333\300\340]"
+    "[']" nil ("-C" "-d" "greek") nil iso-8859-7)))
+
+
 
 ;;;###autoload
 (defcustom ispell-dictionary-alist
   (append ispell-local-dictionary-alist	; dictionary customizations
 	  ispell-dictionary-alist-1 ispell-dictionary-alist-2
 	  ispell-dictionary-alist-3 ispell-dictionary-alist-4
-	  ispell-dictionary-alist-5 ispell-dictionary-alist-6)
+	  ispell-dictionary-alist-5 ispell-dictionary-alist-6
+	  ispell-dictionary-alist-7)
   "An alist of dictionaries and their associated parameters.
 
 Each element of this list is also a list:
@@ -750,7 +761,8 @@
       (append ispell-local-dictionary-alist	; dictionary customizations
 	      ispell-dictionary-alist-1 ispell-dictionary-alist-2
 	      ispell-dictionary-alist-3 ispell-dictionary-alist-4
-	      ispell-dictionary-alist-5 ispell-dictionary-alist-6))
+	      ispell-dictionary-alist-5 ispell-dictionary-alist-6
+	      ispell-dictionary-alist-7))
 

######### END ispell.el PATCH ########################################

Then I simply added the lines:

  (load-library "ispell")
  (setq ispell-program-name "aspell")

in my ".emacs" and everything was set.

As a recent DEBIAN convert, I tried to do something similar but for
all the users of my system, and according to... "the debian
way". Looking arround I saw the "debian-ispell-add-dictionary-entry"
function, and that a set of calls to this (one for every supported
dictionary) is found in
"/var/cache/dictionaries-common/emacsen-ispell-dicts.el", which is
loaded from "/etc/emacs/site-start.d/50dictionaries-common.el".

So I thought that the most "canonical" way to add support for a new
dictionary would be to include the following line in
"50dictionaries-common.el":

  (load "/var/cache/dictionaries-common/emacsen-ispell-dicts.el" t)
+ (load "/var/cache/dictionaries-common/emacsen-ispell-local-dicts.el" t)

and have "emacsen-ispell-local-dicts.el" contain a line like this:

(debian-ispell-add-dictionary-entry
 '("greek"                             ; 8 bit Greek Mode
    "[\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\363\362\364\365\366\367\370\371\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\323\324\325\326\327\330\331\334\335\336\337\374\375\376\266\270\271\272\274\276\277\351\373\332\333\300\340]"
    "[^\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\363\362\364\365\366\367\370\371\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\323\324\325\326\327\330\331\334\335\336\337\374\375\376\266\270\271\272\274\276\277\351\373\332\333\300\340]"
    "[']" nil ("-C" "-d" "greek") nil iso-8859-7) "greek")

Unfortunately, though this seems very similar to the ad-hoc method
described above, _it doesn't work!_ One problem, strange as it may
sound, seems to be with "iso-8859-7". Whenever a add a dictionary with
this encoding, from then-on, the "ispell-change-dictionary" command
stops working!

Is this the correct way to add support for a new local dictionary to
ispell?

Why the "iso-8859-7" entry seems to cause that much trouble (remember
that the scenario with the modified "ispell.el", works fine!).

Thanks in advance
/npat

-- 
Some people say that a monkey would bang out the complete works of
Shakespeare on a typewriter give an unlimited amount of time. In the
meantime, what they would probably produce is a valid sendmail
configuration file.
  -- Nicholas Petreley