emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ispell problem with aspell dictionary aliases


From: David PONCE
Subject: ispell problem with aspell dictionary aliases
Date: Wed, 8 Mar 2006 12:08:17 +0100 (CET)

Hello,

There is an annoying problem with ispell when using aspell
dictionaries.  I noticed that when I change the dictionary to
"francais".  With aspell (0.60.3) and UTF-8 that dictionary doesn't
work well, whereas the "french" dictionary work well.  That surprised
me because the "french" and "francais" dictionaries are both aliases
of the "fr_FR" dictionary.

In fact the problem is in `ispell-find-aspell-dictionaries' which adds
dictionary aliases AFTER the standard definitions have been added,
without overriding them.

The patch below solved the problem for me.

Hope it will help.

Sincerely,
David

In GNU Emacs 22.0.50.8 (i686-pc-linux-gnu, GTK+ Version 2.6.10)
 of 2006-03-08 on localhost
X server distributor `The X.Org Foundation', version 11.0.60802000
configured using `configure '--with-gtk''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8
  default-enable-multibyte-characters: t

2006-03-08  David Ponce  <address@hidden>

        * ispell.el (ispell-find-aspell-dictionaries): Add aliases before
        to merge elements from the standard ispell-dictionary-alist.
        (ispell-aspell-add-aliases): Add aliases to the passed dictionary
        alist, and return the new alist.

Index: lisp/textmodes/ispell.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/textmodes/ispell.el,v
retrieving revision 1.192
diff -u -r1.192 ispell.el
--- lisp/textmodes/ispell.el    17 Feb 2006 11:11:58 -0000      1.192
+++ lisp/textmodes/ispell.el    8 Mar 2006 10:44:28 -0000
@@ -899,14 +899,15 @@
         (found
          (delq nil 
                (mapcar #'ispell-aspell-find-dictionary dictionaries))))
+    ;; Ensure aspell's alias dictionary will override standard
+    ;; definitions.
+    (setq found (ispell-aspell-add-aliases found))
     ;; Merge into FOUND any elements from the standard ispell-dictionary-alist
     ;; which have no element in FOUND at all.    
     (dolist (dict ispell-dictionary-alist)
       (unless (assoc (car dict) found)
        (setq found (nconc found (list dict)))))
     (setq ispell-dictionary-alist found)
-
-    (ispell-aspell-add-aliases)
     ;; Add a default entry
     (let* ((english-dict (assoc "en" ispell-dictionary-alist))
           (default-dict
@@ -973,8 +974,9 @@
       (file-error
        nil))))
 
-(defun ispell-aspell-add-aliases ()
-  "Find aspell's dictionary aliases and add them to `ispell-dictionary-alist'."
+(defun ispell-aspell-add-aliases (alist)
+  "Find aspell's dictionary aliases and add them to dictionary ALIST.
+Return the new dictionary alist."
   (let ((aliases (file-expand-wildcards
                  (concat (or ispell-aspell-dict-dir
                              (setq ispell-aspell-dict-dir
@@ -987,11 +989,12 @@
        (when (search-forward-regexp "^add \\([^.]+\\)\\.multi" nil t)
          (let* ((aliasname (file-name-sans-extension
                             (file-name-nondirectory alias-file)))
-                (already-exists-p (assoc aliasname ispell-dictionary-alist))
+                (already-exists-p (assoc aliasname alist))
                 (realname (match-string 1))
-                (realdict (assoc realname ispell-dictionary-alist)))
+                (realdict (assoc realname alist)))
            (when (and realdict (not already-exists-p))
-             (push (cons aliasname (cdr realdict)) 
ispell-dictionary-alist))))))))
+             (push (cons aliasname (cdr realdict)) alist))))))
+    alist))
 
 (defun ispell-valid-dictionary-list ()
   "Returns a list of valid dictionaries.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]