From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David PONCE Newsgroups: gmane.emacs.devel,gmane.emacs.pretest.bugs Subject: ispell problem with aspell dictionary aliases Date: Wed, 8 Mar 2006 12:08:17 +0100 (CET) Message-ID: <13528943.1141816097534.JavaMail.www@wwinf1506> Reply-To: david.ponce@wanadoo.fr NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1141816243 17885 80.91.229.2 (8 Mar 2006 11:10:43 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 8 Mar 2006 11:10:43 +0000 (UTC) Cc: david@dponce.com, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Mar 08 12:10:36 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FGwYV-0006dw-VZ for ged-emacs-devel@m.gmane.org; Wed, 08 Mar 2006 12:10:14 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FGwYN-0004dp-74 for ged-emacs-devel@m.gmane.org; Wed, 08 Mar 2006 06:10:03 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FGwWz-0004bW-Od for emacs-devel@gnu.org; Wed, 08 Mar 2006 06:08:38 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FGwWn-0004Is-Cc for emacs-devel@gnu.org; Wed, 08 Mar 2006 06:08:33 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FGwWi-0004Gs-7x for emacs-devel@gnu.org; Wed, 08 Mar 2006 06:08:20 -0500 Original-Received: from [199.232.41.67] (helo=mx20.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1FGwZX-0005uz-Bf for emacs-devel@gnu.org; Wed, 08 Mar 2006 06:11:15 -0500 Original-Received: from [193.252.23.84] (helo=smtp15.wanadoo.fr) by mx20.gnu.org with esmtp (Exim 4.52) id 1FGwWh-000822-I9 for emacs-devel@gnu.org; Wed, 08 Mar 2006 06:08:19 -0500 Original-Received: from me-wanadoo.net (localhost [127.0.0.1]) by mwinf1501.wanadoo.fr (SMTP Server) with ESMTP id 89ECE700008B for ; Wed, 8 Mar 2006 12:08:17 +0100 (CET) Original-Received: from wwinf1506 (wwinf1506 [172.22.146.33]) by mwinf1501.wanadoo.fr (SMTP Server) with ESMTP id 858E87000088; Wed, 8 Mar 2006 12:08:17 +0100 (CET) X-ME-UUID: 20060308110817547.858E87000088@mwinf1501.wanadoo.fr Original-To: emacs-pretest-bug@gnu.org X-Originating-IP: [205.167.7.18] X-Wum-Nature: EMAIL-NATURE X-WUM-FROM: |~| X-WUM-TO: |~| X-WUM-CC: |~||~| X-WUM-REPLYTO: |~| X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:51356 gmane.emacs.pretest.bugs:11331 Archived-At: 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 * 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.