all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Agustin Martin <agustin.martin@hispalinux.es>
To: Knut Anders Hatlen <kahatlen@gmail.com>, 7230@debbugs.gnu.org
Subject: bug#7230: 24.0.50; Regression: Many dictionaries not found by ispell.el
Date: Mon, 18 Oct 2010 13:22:47 +0200	[thread overview]
Message-ID: <20101018112247.GA14951@agmartin.aq.upm.es> (raw)
In-Reply-To: <x6tykk67k3.fsf@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 907 bytes --]

On Sun, Oct 17, 2010 at 07:41:16PM +0200, Knut Anders Hatlen wrote:
> 
> On a system with Aspell 0.60.6 with English dictionaries installed,
> evaluating the following expression successfully changes the dictionary
> on Emacs 23.2:
> 
> (progn
>   (require 'ispell)
>   (ispell-change-dictionary "british-ize"))
> 
> On Emacs 24 it fails:

Thanks for noticing and sorry for the bug. I thought it was behaving 
correctly since a lot of English variants were listed and unfortunately 
did not notice that some of them were missing, my fault. I really wonder 
how no one found this before.

This change was introduced to deal with portuguese, that has no pt.dat, but
pt_BR or pt_PT. 

I am currently playing with attached patch, that tries different .dat
matches. This should be better than before, and deal with former case plus
portuguese. Will test a bit more and commit if no problems appear.

-- 
Agustin

[-- Attachment #2: ispell-el_diferent-dat-files.diff --]
[-- Type: text/x-diff, Size: 1478 bytes --]

--- ispell.el.orig	2010-10-18 13:20:35.000000000 +0200
+++ ispell.el	2010-10-18 13:20:45.000000000 +0200
@@ -983,17 +983,30 @@
     (car (split-string (buffer-string)))))
 
 (defun ispell-aspell-find-dictionary (dict-name)
+  "Create a list of properties for a given aspell dictionary."
+  ;; Make sure this is defined
+  (or ispell-aspell-data-dir
+      (setq ispell-aspell-data-dir
+	    (ispell-get-aspell-config-value "data-dir")))
   ;; This returns nil if the data file does not exist.
   ;; Can someone please explain the return value format when the
   ;; file does exist -- rms?
-  (let* ((lang ;; Strip out variant, etc.
-	  (and (string-match "^[[:alpha:]_]+" dict-name)
-	       (match-string 0 dict-name)))
+  (let* ((datafile1
+	  (concat ispell-aspell-data-dir "/"
+		  ;; Strip out variant, country code, etc.
+		  (and (string-match "^[[:alpha:]]+" dict-name)
+		       (match-string 0 dict-name)) ".dat"))
+	 (datafile2
+	  (concat ispell-aspell-data-dir "/"
+		  ;; Strip out anything but xx_YY.
+		  (and (string-match "^[[:alpha:]_]+" dict-name)
+		       (match-string 0 dict-name)) ".dat"))
 	 (data-file
-	  (concat (or ispell-aspell-data-dir
-		      (setq ispell-aspell-data-dir
-			    (ispell-get-aspell-config-value "data-dir")))
-		  "/" lang ".dat"))
+	  (if (file-readable-p datafile1)
+	      datafile1
+	    (if (file-readable-p datafile2)
+		datafile2
+	      "No dat file found")))
 	 otherchars)
     (condition-case ()
 	(with-temp-buffer

  reply	other threads:[~2010-10-18 11:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-17 17:41 bug#7230: 24.0.50; Regression: Many dictionaries not found by ispell.el Knut Anders Hatlen
2010-10-18 11:22 ` Agustin Martin [this message]
2010-10-18 16:16   ` Agustin Martin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20101018112247.GA14951@agmartin.aq.upm.es \
    --to=agustin.martin@hispalinux.es \
    --cc=7230@debbugs.gnu.org \
    --cc=kahatlen@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.