unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* ispell problem with aspell dictionary aliases
@ 2006-03-08 11:08 David PONCE
  2006-03-08 15:22 ` Agustin Martin
  0 siblings, 1 reply; 3+ messages in thread
From: David PONCE @ 2006-03-08 11:08 UTC (permalink / raw)
  Cc: david, emacs-devel

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  <david@dponce.com>

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

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

* Re: ispell problem with aspell dictionary aliases
  2006-03-08 11:08 ispell problem with aspell dictionary aliases David PONCE
@ 2006-03-08 15:22 ` Agustin Martin
  0 siblings, 0 replies; 3+ messages in thread
From: Agustin Martin @ 2006-03-08 15:22 UTC (permalink / raw)


On Wed, Mar 08, 2006 at 12:08:17PM +0100, David PONCE wrote:
> 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.

Can reproduce it with words containing chars not in the iso-8859-1 charset,
like

coeur

not as above, but with 'oe' expressed as a single char (\oe in TeX). With
aspell, ispell-dictionary-alist french entry is utf8 while francais entry
is iso-8859-1.

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

Same here, seems to work well.

-- 
Agustin

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

* Re: ispell problem with aspell dictionary aliases
@ 2006-03-10 10:38 David PONCE
  0 siblings, 0 replies; 3+ messages in thread
From: David PONCE @ 2006-03-10 10:38 UTC (permalink / raw)


Agustin Martin wrote:
> On Wed, Mar 08, 2006 at 12:08:17PM +0100, David PONCE wrote:
>> 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.
> 
> Can reproduce it with words containing chars not in the iso-8859-1 charset,
> like
> 
> coeur
> 
> not as above, but with 'oe' expressed as a single char (\oe in TeX). With
> aspell, ispell-dictionary-alist french entry is utf8 while francais entry
> is iso-8859-1.
> 
>> 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.
> 
> Same here, seems to work well.
> 

Thanks for testing.  So is it possible to commit that fix?
If it helps, I am willing to do it.

David

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

end of thread, other threads:[~2006-03-10 10:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-08 11:08 ispell problem with aspell dictionary aliases David PONCE
2006-03-08 15:22 ` Agustin Martin
  -- strict thread matches above, loose matches on Subject: below --
2006-03-10 10:38 David PONCE

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