all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Richard M. Stallman" <rms@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: ispell-aspell-find-dictionary: Opening input file: no such file or directory
Date: Mon, 17 Oct 2005 00:33:18 -0400	[thread overview]
Message-ID: <E1ERMgY-00008P-JK@fencepost.gnu.org> (raw)
In-Reply-To: <20051013154818.GC8236@eugene-home.ikz.ru> (message from Eugene Vlasov on Thu, 13 Oct 2005 21:48:18 +0600)

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

  reply	other threads:[~2005-10-17  4:33 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

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=E1ERMgY-00008P-JK@fencepost.gnu.org \
    --to=rms@gnu.org \
    --cc=emacs-devel@gnu.org \
    /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.