all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* ispell-aspell-find-dictionary: Opening input file: no such file or directory
@ 2005-09-29 17:18 Eugene Vlasov
  2005-10-13 12:44 ` Magnus Henoch
  0 siblings, 1 reply; 12+ messages in thread
From: Eugene Vlasov @ 2005-09-29 17:18 UTC (permalink / raw)


Hi.

After this:

2005-09-24  Magnus Henoch  <mange@freemail.hu>

        * textmodes/ispell.el (ispell-maybe-find-aspell-dictionaries):
        New function, code extracted from ispell-valid-dictionary-list.
        (ispell-valid-dictionary-list, ispell-accept-buffer-local-defs):
        Call it.

spell checking on my system broken:
$ emacs -q
M-x flyspell-mode <RET>

Loading flyspell...done
Loading regexp-opt...done
ispell-aspell-find-dictionary: Opening input file: no such file or directory, /usr/share/aspell/ru.dat

M-x ispell-buffer <RET>

ispell-aspell-find-dictionary: Opening input file: no such file or directory, /usr/share/aspell/ru.dat

$ ls /usr/share/aspell/ru*

/usr/share/aspell/ru-lebedev.dat
/usr/share/aspell/ru-lebedev_phonet.dat
/usr/share/aspell/ru-rk.dat
/usr/share/aspell/ru-rk_phonet.dat

$ aspell dicts

en
en_CA
en_CA-w-accents
en_CA-wo-accents
en_GB
en_GB-w-accents
en_GB-wo-accents
en_US
en_US-w-accents
en_US-wo-accents
ru
ru-lebedev
ru-lebedev-ie
ru-lebedev-io
ru-rk

$ aspell -v

@(#) International Ispell Version 3.1.20 (but really Aspell 0.60)

M-x emacs-version

GNU Emacs 22.0.50.1 (i686-pc-linux-gnu, GTK+ Version 2.8.3) of 2005-09-29 on eugene-home.ikz.ru


-- 
Eugene Vlasov                       mailto:eugvv at altlinux.ru

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

* Re: ispell-aspell-find-dictionary: Opening input file: no such file or directory
  2005-09-29 17:18 ispell-aspell-find-dictionary: Opening input file: no such file or directory Eugene Vlasov
@ 2005-10-13 12:44 ` Magnus Henoch
  2005-10-13 14:47   ` Stefan Monnier
                     ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Magnus Henoch @ 2005-10-13 12:44 UTC (permalink / raw)
  Cc: kevina

Eugene Vlasov <eugene@ikz.ru> writes:

> After this:
>
> 2005-09-24  Magnus Henoch  <mange@freemail.hu>
>
>         * textmodes/ispell.el (ispell-maybe-find-aspell-dictionaries):
>         New function, code extracted from ispell-valid-dictionary-list.
>         (ispell-valid-dictionary-list, ispell-accept-buffer-local-defs):
>         Call it.
>
> spell checking on my system broken:
> $ emacs -q
> M-x flyspell-mode <RET>
>
> Loading flyspell...done
> Loading regexp-opt...done
> ispell-aspell-find-dictionary: Opening input file: no such file or directory, /usr/share/aspell/ru.dat
>
> M-x ispell-buffer <RET>
>
> ispell-aspell-find-dictionary: Opening input file: no such file or directory, /usr/share/aspell/ru.dat
>
> $ ls /usr/share/aspell/ru*
>
> /usr/share/aspell/ru-lebedev.dat
> /usr/share/aspell/ru-lebedev_phonet.dat
> /usr/share/aspell/ru-rk.dat
> /usr/share/aspell/ru-rk_phonet.dat
>
> $ aspell dicts
>
> en
> en_CA
> en_CA-w-accents
> en_CA-wo-accents
> en_GB
> en_GB-w-accents
> en_GB-wo-accents
> en_US
> en_US-w-accents
> en_US-wo-accents
> ru
> ru-lebedev
> ru-lebedev-ie
> ru-lebedev-io
> ru-rk

Sorry about the delay...

I've investigated this, and I'm not sure whether the bug is in
ispell.el, in the dictionaries used, or in aspell.

All dictionaries specify a .dat file (near the beginning of the binary
file).  The aspell manual says that this is named `LANG.dat', but the
ru-{lebedev,rk} dictionaries use ru-{lebedev,rk}.dat instead.  I'm
reluctant to parse the dictionary file from ispell.el, and "aspell -d
ru-lebedev config lang" gives "<unknown>" - making that return the
name of the .dat file minus .dat would be one way of fixing the problem.

The particular RPMs of these dictionaries that I found install
symlinks in the alternatives system, so that using the "ru" dictionary
will select one of them.  Given that, they could simply reference
ru.dat and get the right file, but that might not be in the in the
interest of the upstream maintainer.

On the third hand, ispell.el could try to find the real name of the
used dictionary (beyond symlinks), and try DICT.dat if LANG.dat
doesn't exist.  That would fix at least this particular problem.

So, I'm asking for advice: which of these should be fixed?  Or is
there another possible way?

Magnus

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

* Re: ispell-aspell-find-dictionary: Opening input file: no such file or directory
  2005-10-13 12:44 ` Magnus Henoch
@ 2005-10-13 14:47   ` Stefan Monnier
  2005-10-13 15:48   ` Eugene Vlasov
  2005-10-14 17:37   ` Richard M. Stallman
  2 siblings, 0 replies; 12+ messages in thread
From: Stefan Monnier @ 2005-10-13 14:47 UTC (permalink / raw)


> I've investigated this, and I'm not sure whether the bug is in
> ispell.el, in the dictionaries used, or in aspell.
[...]
> So, I'm asking for advice: which of these should be fixed?  Or is
> there another possible way?

I can't say where is the bug, but since it used to work in Emacs before your
changes, I think it's worth it to try and change Emacs such that it
works again.  I.e. try DICT.dat additionally to LANG.dat.  It's probably not
the best fix, but it's at least a workaround that will get us back the
behavior we enjoyed before.


        Stefan

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

* Re: ispell-aspell-find-dictionary: Opening input file: no such file or directory
  2005-10-13 12:44 ` Magnus Henoch
  2005-10-13 14:47   ` Stefan Monnier
@ 2005-10-13 15:48   ` Eugene Vlasov
  2005-10-17  4:33     ` Richard M. Stallman
  2005-10-14 17:37   ` Richard M. Stallman
  2 siblings, 1 reply; 12+ messages in thread
From: Eugene Vlasov @ 2005-10-13 15:48 UTC (permalink / raw)


On Thu, Oct 13, 2005 at 02:44:19PM +0200 Magnus Henoch wrote:

>> ispell-aspell-find-dictionary: Opening input file: no such file or directory, /usr/share/aspell/ru.dat

> I've investigated this, and I'm not sure whether the bug is in
> ispell.el, in the dictionaries used, or in aspell.

> So, I'm asking for advice: which of these should be fixed?  Or is
> there another possible way?

I don't know where the bug, but may be fallback to default value of
ispell-dictionary-alist if (ispell-aspell-find-dictionary)
unsuccessfull? This is not fix bug, but fix spell checking in cases
like described.


-- 
Eugene Vlasov                       mailto:eugvv at altlinux.ru

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

* Re: ispell-aspell-find-dictionary: Opening input file: no such file or directory
  2005-10-13 12:44 ` Magnus Henoch
  2005-10-13 14:47   ` Stefan Monnier
  2005-10-13 15:48   ` Eugene Vlasov
@ 2005-10-14 17:37   ` Richard M. Stallman
  2005-10-14 18:31     ` Eugene Vlasov
  2 siblings, 1 reply; 12+ messages in thread
From: Richard M. Stallman @ 2005-10-14 17:37 UTC (permalink / raw)
  Cc: emacs-devel

    All dictionaries specify a .dat file (near the beginning of the binary
    file).  The aspell manual says that this is named `LANG.dat', but the
    ru-{lebedev,rk} dictionaries use ru-{lebedev,rk}.dat instead.  I'm
    reluctant to parse the dictionary file from ispell.el, and "aspell -d
    ru-lebedev config lang" gives "<unknown>" - making that return the
    name of the .dat file minus .dat would be one way of fixing the problem.

If aspell does not match what its manual says, one or the other of
them has a bug.  So it seems to me that something needs to be fixed
in the aspell package.

So how about if you and Kevin Atkinson work out how a clean
solution for this problem, and then we implement it?

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

* Re: ispell-aspell-find-dictionary: Opening input file: no such file or directory
  2005-10-14 17:37   ` Richard M. Stallman
@ 2005-10-14 18:31     ` Eugene Vlasov
  0 siblings, 0 replies; 12+ messages in thread
From: Eugene Vlasov @ 2005-10-14 18:31 UTC (permalink / raw)


On Fri, Oct 14, 2005 at 01:37:17PM -0400 Richard M. Stallman wrote:

> If aspell does not match what its manual says, one or the other of
> them has a bug.

Here some text from info(1) aspell:

As with previous versions of Aspell you can specify the main dictionary
to use via the `-d' or `--master' option.  However as of Aspell .32 you
can now also:

  1. Specify more than word list to use with the `extra-dicts' option.

  2. Specify special _multi_ dictionaries.

...

   A _multi_ dictionary is a special file which is basically a list of
dictionary files to use.  A _multi_ dictionary must end in `.multi' and
has roughly the same format as a configuration file with the only
accepted key being `add'.

In my case:

$ ls `aspell config dict-dir`/*.multi

/usr/lib/aspell/en_CA-w-accents.multi
/usr/lib/aspell/en_CA-wo-accents.multi
/usr/lib/aspell/en_GB-w-accents.multi
/usr/lib/aspell/en_GB-wo-accents.multi
/usr/lib/aspell/en.multi
/usr/lib/aspell/en_US-w-accents.multi
/usr/lib/aspell/en_US-wo-accents.multi
/usr/lib/aspell/ru-lebedev-ie.multi
/usr/lib/aspell/ru-lebedev-io.multi
/usr/lib/aspell/ru-lebedev.multi
/usr/lib/aspell/ru.multi

$ cat /usr/lib/aspell/ru.multi

add ru-lebedev-common-only.rws
add ru-lebedev-ie-only.rws
add ru-lebedev-io-only.rws


-- 
Eugene Vlasov                       mailto:eugvv at altlinux.ru

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

* Re: ispell-aspell-find-dictionary: Opening input file: no such file or directory
  2005-10-13 15:48   ` Eugene Vlasov
@ 2005-10-17  4:33     ` Richard M. Stallman
  2005-10-17  7:21       ` Eugene Vlasov
  0 siblings, 1 reply; 12+ messages in thread
From: Richard M. Stallman @ 2005-10-17  4:33 UTC (permalink / raw)
  Cc: emacs-devel

    I don't know where the bug, but may be fallback to default value of
    ispell-dictionary-alist if (ispell-aspell-find-dictionary)
    unsuccessfull? This is not fix bug, but fix spell checking in cases
    like described.

I think this change should do it.  Does it give good results?

*** ispell.el	09 Oct 2005 11:42:04 -0400	1.181
--- ispell.el	16 Oct 2005 20:32:45 -0400	
***************
*** 900,906 ****
  	    (call-process ispell-program-name nil t nil "dicts")
  	    (buffer-string)))))
      (setq ispell-dictionary-alist
! 	  (mapcar #'ispell-aspell-find-dictionary dictionaries))
      (ispell-aspell-add-aliases)
      ;; Add a default entry
      (let* ((english-dict (assoc "en" ispell-dictionary-alist))
--- 900,907 ----
  	    (call-process ispell-program-name nil t nil "dicts")
  	    (buffer-string)))))
      (setq ispell-dictionary-alist
! 	  (delq nil 
! 		(mapcar #'ispell-aspell-find-dictionary dictionaries)))
      (ispell-aspell-add-aliases)
      ;; Add a default entry
      (let* ((english-dict (assoc "en" ispell-dictionary-alist))
***************
*** 922,927 ****
--- 923,931 ----
      (car (split-string (buffer-string)))))
  
  (defun ispell-aspell-find-dictionary (dict-name)
+   ;; 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 region, variant, etc.
  	  (and (string-match "^[[:alpha:]]+" dict-name)
  	       (match-string 0 dict-name)))
***************
*** 931,965 ****
  			    (ispell-get-aspell-config-value "data-dir")))
  		  "/" lang ".dat"))
  	 otherchars)
!     ;; This file really should exist; there is no sensible recovery.
!     (with-temp-buffer
!       (insert-file-contents data-file)
!       ;; There is zero or one line with special characters declarations.
!       (when (search-forward-regexp "^special" nil t)
! 	(let ((specials (split-string
! 			 (buffer-substring (point)
! 					   (progn (end-of-line) (point))))))
! 	  ;; The line looks like: special ' -** - -** . -** : -*-
! 	  ;; -** means that this character
! 	  ;;    - doesn't appear at word start
! 	  ;;    * may appear in the middle of a word
! 	  ;;    * may appear at word end
! 	  ;; `otherchars' is about the middle case.
! 	  (while specials
! 	    (when (eq (aref (cadr specials) 1) ?*)
! 	      (push (car specials) otherchars))
! 	    (setq specials (cddr specials))))))
!     (list dict-name
! 	  "[[:alpha:]]"
! 	  "[^[:alpha:]]"
! 	  (regexp-opt otherchars)
! 	  t 				; We can't tell, so set this to t
! 	  (list "-d" dict-name "--encoding=utf-8")
! 	  nil				; aspell doesn't support this
! 	  ;; Here we specify the encoding to use while communicating with
! 	  ;; aspell.  This doesn't apply to command line arguments, so
! 	  ;; just don't pass words to spellcheck as arguments...
! 	  'utf-8)))
  
  (defun ispell-aspell-add-aliases ()
    "Find aspell's dictionary aliases and add them to `ispell-dictionary-alist'."
--- 935,971 ----
  			    (ispell-get-aspell-config-value "data-dir")))
  		  "/" lang ".dat"))
  	 otherchars)
!     (condition-case ()
! 	(with-temp-buffer
! 	  (insert-file-contents data-file)
! 	  ;; There is zero or one line with special characters declarations.
! 	  (when (search-forward-regexp "^special" nil t)
! 	    (let ((specials (split-string
! 			     (buffer-substring (point)
! 					       (progn (end-of-line) (point))))))
! 	      ;; The line looks like: special ' -** - -** . -** : -*-
! 	      ;; -** means that this character
! 	      ;;    - doesn't appear at word start
! 	      ;;    * may appear in the middle of a word
! 	      ;;    * may appear at word end
! 	      ;; `otherchars' is about the middle case.
! 	      (while specials
! 		(when (eq (aref (cadr specials) 1) ?*)
! 		  (push (car specials) otherchars))
! 		(setq specials (cddr specials)))))
! 	  (list dict-name
! 		"[[:alpha:]]"
! 		"[^[:alpha:]]"
! 		(regexp-opt otherchars)
! 		t			     ; We can't tell, so set this to t
! 		(list "-d" dict-name "--encoding=utf-8")
! 		nil				; aspell doesn't support this
! 		;; Here we specify the encoding to use while communicating with
! 		;; aspell.  This doesn't apply to command line arguments, so
! 		;; just don't pass words to spellcheck as arguments...
! 		'utf-8))
!       (file-error
!        nil))))
  
  (defun ispell-aspell-add-aliases ()
    "Find aspell's dictionary aliases and add them to `ispell-dictionary-alist'."

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

* Re: ispell-aspell-find-dictionary: Opening input file: no such file or directory
  2005-10-17  4:33     ` Richard M. Stallman
@ 2005-10-17  7:21       ` Eugene Vlasov
  2005-10-18  3:39         ` Richard M. Stallman
  0 siblings, 1 reply; 12+ messages in thread
From: Eugene Vlasov @ 2005-10-17  7:21 UTC (permalink / raw)
  Cc: emacs-devel

On Mon, Oct 17, 2005 at 12:33:18AM -0400 Richard M. Stallman wrote:

>     I don't know where the bug, but may be fallback to default value of
>     ispell-dictionary-alist if (ispell-aspell-find-dictionary)
>     unsuccessfull?

> I think this change should do it.  Does it give good results?

No, bad. Default value of ispell-dictionary-alist includes needed for
me "russian" dictionary. But after initialize spell checking with this
patch, i have in this list only english, canadian, british
dictionaries.

> *** ispell.el	09 Oct 2005 11:42:04 -0400	1.181
> --- ispell.el	16 Oct 2005 20:32:45 -0400	


-- 
WBR, Eugene Vlasov        mailto:eugvv at altlinux.ru
                          JID: eugvv@jabber.ru

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

* Re: ispell-aspell-find-dictionary: Opening input file: no such file or directory
  2005-10-17  7:21       ` Eugene Vlasov
@ 2005-10-18  3:39         ` Richard M. Stallman
  2005-10-18  6:24           ` Eugene Vlasov
  0 siblings, 1 reply; 12+ messages in thread
From: Richard M. Stallman @ 2005-10-18  3:39 UTC (permalink / raw)
  Cc: mange, emacs-devel

    >     I don't know where the bug, but may be fallback to default value of
    >     ispell-dictionary-alist if (ispell-aspell-find-dictionary)
    >     unsuccessfull?

    > I think this change should do it.  Does it give good results?

    No, bad. Default value of ispell-dictionary-alist includes needed for
    me "russian" dictionary. But after initialize spell checking with this
    patch, i have in this list only english, canadian, british
    dictionaries.

That's what I designed it to do: to discard dictionaries for which it
cannot get the data.  That is better than getting an error.  And it
can't use those dictionaries if it can't get the data about them.

So I don't see how this change could be bad.  How is it possible
to use any dictionaries for which the data can't be obtained?
Is there a way?  Could someone explain?

The ideal thing would be to get the proper data about those
dictionaries.  But I don't know how to do that.  Do you?

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

* Re: ispell-aspell-find-dictionary: Opening input file: no such file or directory
  2005-10-18  3:39         ` Richard M. Stallman
@ 2005-10-18  6:24           ` Eugene Vlasov
  2005-10-19  2:44             ` Richard M. Stallman
  0 siblings, 1 reply; 12+ messages in thread
From: Eugene Vlasov @ 2005-10-18  6:24 UTC (permalink / raw)
  Cc: mange, emacs-devel

On Mon, Oct 17, 2005 at 11:39:43PM -0400 Richard M. Stallman:

>     No, bad. Default value of ispell-dictionary-alist includes needed for
>     me "russian" dictionary. But after initialize spell checking with this
>     patch, i have in this list only english, canadian, british
>     dictionaries.

> That's what I designed it to do: to discard dictionaries for which it
> cannot get the data.
> So I don't see how this change could be bad.  How is it possible
> to use any dictionaries for which the data can't be obtained?

But I have russian dictionary in my system, and spell checking with
this dictionary worked, and I use it with default value of
ispell-dictionary-alist (I just remove calls of
(ispell-maybe-find-aspell-dictionaries)). So with this change spell
checking in emacs 22 stay broken for me.

Another workaround idea - may be define custom variable that disables
finding dictionaries if has value t?


-- 
WBR, Eugene Vlasov        mailto:eugvv at altlinux.ru
                          JID: eugvv@jabber.ru

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

* Re: ispell-aspell-find-dictionary: Opening input file: no such file or directory
  2005-10-18  6:24           ` Eugene Vlasov
@ 2005-10-19  2:44             ` Richard M. Stallman
  2005-10-19  6:24               ` Eugene Vlasov
  0 siblings, 1 reply; 12+ messages in thread
From: Richard M. Stallman @ 2005-10-19  2:44 UTC (permalink / raw)
  Cc: mange, emacs-devel

This patch tries to preserve standard elements of ispell-dictionary-alist
for dictionaries that are not found by ispell-aspell-find-dictionary.
Does it do the job for you?

*** ispell.el	09 Oct 2005 11:42:04 -0400	1.181
--- ispell.el	18 Oct 2005 21:48:24 -0400	
***************
*** 898,906 ****
  	 (split-string
  	  (with-temp-buffer
  	    (call-process ispell-program-name nil t nil "dicts")
! 	    (buffer-string)))))
!     (setq ispell-dictionary-alist
! 	  (mapcar #'ispell-aspell-find-dictionary dictionaries))
      (ispell-aspell-add-aliases)
      ;; Add a default entry
      (let* ((english-dict (assoc "en" ispell-dictionary-alist))
--- 898,915 ----
  	 (split-string
  	  (with-temp-buffer
  	    (call-process ispell-program-name nil t nil "dicts")
! 	    (buffer-string))))
! 	;; Search for the named dictionaries.
! 	(found
! 	 (delq nil 
! 	       (mapcar #'ispell-aspell-find-dictionary dictionaries))))
!     ;; 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))
***************
*** 922,927 ****
--- 931,939 ----
      (car (split-string (buffer-string)))))
  
  (defun ispell-aspell-find-dictionary (dict-name)
+   ;; 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 region, variant, etc.
  	  (and (string-match "^[[:alpha:]]+" dict-name)
  	       (match-string 0 dict-name)))
***************
*** 931,965 ****
  			    (ispell-get-aspell-config-value "data-dir")))
  		  "/" lang ".dat"))
  	 otherchars)
!     ;; This file really should exist; there is no sensible recovery.
!     (with-temp-buffer
!       (insert-file-contents data-file)
!       ;; There is zero or one line with special characters declarations.
!       (when (search-forward-regexp "^special" nil t)
! 	(let ((specials (split-string
! 			 (buffer-substring (point)
! 					   (progn (end-of-line) (point))))))
! 	  ;; The line looks like: special ' -** - -** . -** : -*-
! 	  ;; -** means that this character
! 	  ;;    - doesn't appear at word start
! 	  ;;    * may appear in the middle of a word
! 	  ;;    * may appear at word end
! 	  ;; `otherchars' is about the middle case.
! 	  (while specials
! 	    (when (eq (aref (cadr specials) 1) ?*)
! 	      (push (car specials) otherchars))
! 	    (setq specials (cddr specials))))))
!     (list dict-name
! 	  "[[:alpha:]]"
! 	  "[^[:alpha:]]"
! 	  (regexp-opt otherchars)
! 	  t 				; We can't tell, so set this to t
! 	  (list "-d" dict-name "--encoding=utf-8")
! 	  nil				; aspell doesn't support this
! 	  ;; Here we specify the encoding to use while communicating with
! 	  ;; aspell.  This doesn't apply to command line arguments, so
! 	  ;; just don't pass words to spellcheck as arguments...
! 	  'utf-8)))
  
  (defun ispell-aspell-add-aliases ()
    "Find aspell's dictionary aliases and add them to `ispell-dictionary-alist'."
--- 943,979 ----
  			    (ispell-get-aspell-config-value "data-dir")))
  		  "/" lang ".dat"))
  	 otherchars)
!     (condition-case ()
! 	(with-temp-buffer
! 	  (insert-file-contents data-file)
! 	  ;; There is zero or one line with special characters declarations.
! 	  (when (search-forward-regexp "^special" nil t)
! 	    (let ((specials (split-string
! 			     (buffer-substring (point)
! 					       (progn (end-of-line) (point))))))
! 	      ;; The line looks like: special ' -** - -** . -** : -*-
! 	      ;; -** means that this character
! 	      ;;    - doesn't appear at word start
! 	      ;;    * may appear in the middle of a word
! 	      ;;    * may appear at word end
! 	      ;; `otherchars' is about the middle case.
! 	      (while specials
! 		(when (eq (aref (cadr specials) 1) ?*)
! 		  (push (car specials) otherchars))
! 		(setq specials (cddr specials)))))
! 	  (list dict-name
! 		"[[:alpha:]]"
! 		"[^[:alpha:]]"
! 		(regexp-opt otherchars)
! 		t			     ; We can't tell, so set this to t
! 		(list "-d" dict-name "--encoding=utf-8")
! 		nil				; aspell doesn't support this
! 		;; Here we specify the encoding to use while communicating with
! 		;; aspell.  This doesn't apply to command line arguments, so
! 		;; just don't pass words to spellcheck as arguments...
! 		'utf-8))
!       (file-error
!        nil))))
  
  (defun ispell-aspell-add-aliases ()
    "Find aspell's dictionary aliases and add them to `ispell-dictionary-alist'."

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

* Re: ispell-aspell-find-dictionary: Opening input file: no such file or directory
  2005-10-19  2:44             ` Richard M. Stallman
@ 2005-10-19  6:24               ` Eugene Vlasov
  0 siblings, 0 replies; 12+ messages in thread
From: Eugene Vlasov @ 2005-10-19  6:24 UTC (permalink / raw)
  Cc: mange, emacs-devel

On Tue, Oct 18, 2005 at 10:44:01PM -0400 Richard M. Stallman wrote:

> This patch tries to preserve standard elements of ispell-dictionary-alist
> for dictionaries that are not found by ispell-aspell-find-dictionary.
> Does it do the job for you?

Yes, with this patch I can check spell with russian dictionary. But
here error:

> --- 898,915 ----
>   	 (split-string
>   	  (with-temp-buffer
>   	    (call-process ispell-program-name nil t nil "dicts")
> ! 	    (buffer-string))))
> ! 	;; Search for the named dictionaries.
> ! 	(found
> ! 	 (delq nil 
> ! 	       (mapcar #'ispell-aspell-find-dictionary dictionaries))))

Variable dictionaries not bound at this time. I use let*:

--- emacs/lisp/textmodes/ispell.el	2005-10-09 19:02:50 +0600
+++ emacs.build/lisp/textmodes/ispell.el	2005-10-19 12:08:20 +0600
@@ -894,13 +894,22 @@
   "Find Aspell's dictionaries, and record in `ispell-dictionary-alist'."
   (unless ispell-really-aspell
     (error "This function only works with aspell"))
-  (let ((dictionaries
+  (let* ((dictionaries
 	 (split-string
 	  (with-temp-buffer
 	    (call-process ispell-program-name nil t nil "dicts")
-	    (buffer-string)))))
-    (setq ispell-dictionary-alist
-	  (mapcar #'ispell-aspell-find-dictionary dictionaries))
+	    (buffer-string))))
+	;; Search for the named dictionaries.
+	(found
+	 (delq nil 
+	       (mapcar #'ispell-aspell-find-dictionary dictionaries))))
+    ;; 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))
@@ -922,6 +931,9 @@
     (car (split-string (buffer-string)))))
 
 (defun ispell-aspell-find-dictionary (dict-name)
+  ;; 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 region, variant, etc.
 	  (and (string-match "^[[:alpha:]]+" dict-name)
 	       (match-string 0 dict-name)))
@@ -931,35 +943,37 @@
 			    (ispell-get-aspell-config-value "data-dir")))
 		  "/" lang ".dat"))
 	 otherchars)
-    ;; This file really should exist; there is no sensible recovery.
-    (with-temp-buffer
-      (insert-file-contents data-file)
-      ;; There is zero or one line with special characters declarations.
-      (when (search-forward-regexp "^special" nil t)
-	(let ((specials (split-string
-			 (buffer-substring (point)
-					   (progn (end-of-line) (point))))))
-	  ;; The line looks like: special ' -** - -** . -** : -*-
-	  ;; -** means that this character
-	  ;;    - doesn't appear at word start
-	  ;;    * may appear in the middle of a word
-	  ;;    * may appear at word end
-	  ;; `otherchars' is about the middle case.
-	  (while specials
-	    (when (eq (aref (cadr specials) 1) ?*)
-	      (push (car specials) otherchars))
-	    (setq specials (cddr specials))))))
-    (list dict-name
-	  "[[:alpha:]]"
-	  "[^[:alpha:]]"
-	  (regexp-opt otherchars)
-	  t 				; We can't tell, so set this to t
-	  (list "-d" dict-name "--encoding=utf-8")
-	  nil				; aspell doesn't support this
-	  ;; Here we specify the encoding to use while communicating with
-	  ;; aspell.  This doesn't apply to command line arguments, so
-	  ;; just don't pass words to spellcheck as arguments...
-	  'utf-8)))
+    (condition-case ()
+	(with-temp-buffer
+	  (insert-file-contents data-file)
+	  ;; There is zero or one line with special characters declarations.
+	  (when (search-forward-regexp "^special" nil t)
+	    (let ((specials (split-string
+			     (buffer-substring (point)
+					       (progn (end-of-line) (point))))))
+	      ;; The line looks like: special ' -** - -** . -** : -*-
+	      ;; -** means that this character
+	      ;;    - doesn't appear at word start
+	      ;;    * may appear in the middle of a word
+	      ;;    * may appear at word end
+	      ;; `otherchars' is about the middle case.
+	      (while specials
+		(when (eq (aref (cadr specials) 1) ?*)
+		  (push (car specials) otherchars))
+		(setq specials (cddr specials)))))
+	  (list dict-name
+		"[[:alpha:]]"
+		"[^[:alpha:]]"
+		(regexp-opt otherchars)
+		t			     ; We can't tell, so set this to t
+		(list "-d" dict-name "--encoding=utf-8")
+		nil				; aspell doesn't support this
+		;; Here we specify the encoding to use while communicating with
+		;; aspell.  This doesn't apply to command line arguments, so
+		;; just don't pass words to spellcheck as arguments...
+		'utf-8))
+      (file-error
+       nil))))
 
 (defun ispell-aspell-add-aliases ()
   "Find aspell's dictionary aliases and add them to `ispell-dictionary-alist'."


With this changes spell checking works for me.


-- 
WBR, Eugene Vlasov        mailto:eugvv at altlinux.ru
                          JID: eugvv@jabber.ru

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

end of thread, other threads:[~2005-10-19  6:24 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-29 17:18 ispell-aspell-find-dictionary: Opening input file: no such file or directory Eugene Vlasov
2005-10-13 12:44 ` Magnus Henoch
2005-10-13 14:47   ` Stefan Monnier
2005-10-13 15:48   ` Eugene Vlasov
2005-10-17  4:33     ` Richard M. Stallman
2005-10-17  7:21       ` Eugene Vlasov
2005-10-18  3:39         ` Richard M. Stallman
2005-10-18  6:24           ` Eugene Vlasov
2005-10-19  2:44             ` Richard M. Stallman
2005-10-19  6:24               ` Eugene Vlasov
2005-10-14 17:37   ` Richard M. Stallman
2005-10-14 18:31     ` Eugene Vlasov

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.