From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Agustin Martin Newsgroups: gmane.emacs.bugs Subject: bug#6539: ispell-complete-word looks for wrong file (at least on w32) Date: Mon, 5 Jul 2010 13:52:22 +0200 Message-ID: <20100705115222.GA2013@agmartin.aq.upm.es> References: <20100630103826.GA3847@agmartin.aq.upm.es> <20100630122747.GA20074@agmartin.aq.upm.es> <836310bezc.fsf@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="vtzGhvizbBRQ85DL" X-Trace: dough.gmane.org 1278331228 19999 80.91.229.12 (5 Jul 2010 12:00:28 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 5 Jul 2010 12:00:28 +0000 (UTC) To: 6539@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Jul 05 14:00:26 2010 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OVkLV-0003A9-74 for geb-bug-gnu-emacs@m.gmane.org; Mon, 05 Jul 2010 14:00:22 +0200 Original-Received: from localhost ([127.0.0.1]:57603 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OVkLU-0005kQ-2g for geb-bug-gnu-emacs@m.gmane.org; Mon, 05 Jul 2010 08:00:20 -0400 Original-Received: from [140.186.70.92] (port=37528 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OVkKw-0005az-7U for bug-gnu-emacs@gnu.org; Mon, 05 Jul 2010 07:59:48 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OVkKu-00046f-L0 for bug-gnu-emacs@gnu.org; Mon, 05 Jul 2010 07:59:46 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:36558) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OVkKu-00046a-JL for bug-gnu-emacs@gnu.org; Mon, 05 Jul 2010 07:59:44 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1OVkEP-0002Ev-KF; Mon, 05 Jul 2010 07:53:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Agustin Martin Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 05 Jul 2010 11:53:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 6539 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 6539-submit@debbugs.gnu.org id=B6539.12783307518602 (code B ref 6539); Mon, 05 Jul 2010 11:53:01 +0000 Original-Received: (at 6539) by debbugs.gnu.org; 5 Jul 2010 11:52:31 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OVkDv-0002Eh-GP for submit@debbugs.gnu.org; Mon, 05 Jul 2010 07:52:31 -0400 Original-Received: from edison.ccupm.upm.es ([138.100.4.49]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OVkDs-0002EZ-OS for 6539@debbugs.gnu.org; Mon, 05 Jul 2010 07:52:29 -0400 Original-Received: from agmartin.aq.upm.es (Agmartin.aq.upm.es [138.100.41.131]) by edison.ccupm.upm.es (8.13.8/8.13.8) with ESMTP id o65BqMu4008300; Mon, 5 Jul 2010 13:52:22 +0200 Original-Received: by agmartin.aq.upm.es (Postfix, from userid 1000) id 6FEB0463B1; Mon, 5 Jul 2010 13:52:22 +0200 (CEST) Content-Disposition: inline In-Reply-To: <836310bezc.fsf@gnu.org> User-Agent: Mutt/1.5.20 (2009-06-14) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Mon, 05 Jul 2010 07:53:01 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:38234 Archived-At: --vtzGhvizbBRQ85DL Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, Jun 30, 2010 at 08:35:35PM +0300, Eli Zaretskii wrote: > > Date: Wed, 30 Jun 2010 14:27:47 +0200 > > From: Agustin Martin > > Cc: > > > > > > I think that this bug report can be closed or renamed to something like > > > > 'Improve `ispell-alternate-dictionary' docstring'. > > > > > > I think the default for ispell-alternate-dictionary should be changed on w32. > > > > Or, more globally, find a good and not confusing name for default personal > > plain wordlist that can be used in every system, be it w32 or not, so it is > > tried first in `ispell-alternate-dictionary', something like > > > > (expand-file-name "~/.personal.words") > > How will that help, exactly? /usr/dict/words exists on almost every > Posix system, which is why ispell.el has that as the default. But > there's no comparable functionality on Windows, so the only way of > getting this work on Windows is to find or download such a file from > somewhere, and manually install it in some arbitrary directory. How > is Emacs supposed to know whether such a file exists, and where? [Really attaching diff] My initial intention was to provide an out-of-the box default for personal wordlist, useful for both w32 and *X systems. However, as you point out in another message, since this is originally an Ispell feature, I think I should not add an Emacs specific difference. Customizing `ispell-alternate-dictionary' (or `ispell-complete-word-dict') seems the way to go. However, docstrings and error handling for this complete-word stuff needs to be improved, so it provides useful and accurate information. I am currently trying something like attached patch where `ispell-alternate-dictionary' is set to nil if no default is found and checked before use. I find error message too long, but better that before. As usually, suggestions are welcome. It also changes `file-exists-p' to `file-readable-p' in `ispell-alternate-dictionary' definition. I have also noticed that ispell.el uses `ispell-alternate-dictionary' and `ispell-complete-word-dict' in a way that seems to be interchangeable, but confusing. The former was probably used at some time as a real alternate dictionary for spellchecking, but current use seems to be for completion. Have to think a bit more about this. Cheers, -- Agustin --vtzGhvizbBRQ85DL Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="ispell.el_complete-word-2.diff" --- ispell.el.orig 2010-07-05 11:31:21.000000000 +0200 +++ ispell.el 2010-07-05 13:25:03.000000000 +0200 @@ -357,21 +357,20 @@ :group 'ispell) (defcustom ispell-alternate-dictionary - (cond ((file-exists-p "/usr/dict/web2") "/usr/dict/web2") - ((file-exists-p "/usr/share/dict/web2") "/usr/share/dict/web2") - ((file-exists-p "/usr/dict/words") "/usr/dict/words") - ((file-exists-p "/usr/lib/dict/words") "/usr/lib/dict/words") - ((file-exists-p "/usr/share/dict/words") "/usr/share/dict/words") - ((file-exists-p "/usr/share/lib/dict/words") + (cond ((file-readable-p "/usr/dict/web2") "/usr/dict/web2") + ((file-readable-p "/usr/share/dict/web2") "/usr/share/dict/web2") + ((file-readable-p "/usr/dict/words") "/usr/dict/words") + ((file-readable-p "/usr/lib/dict/words") "/usr/lib/dict/words") + ((file-readable-p "/usr/share/dict/words") "/usr/share/dict/words") + ((file-readable-p "/usr/share/lib/dict/words") "/usr/share/lib/dict/words") - ((file-exists-p "/sys/dict") "/sys/dict") - (t "/usr/dict/words")) - "*Alternate dictionary for spelling help." + ((file-readable-p "/sys/dict") "/sys/dict")) + "*Alternate plain word-list dictionary for spelling help." :type '(choice file (const :tag "None" nil)) :group 'ispell) (defcustom ispell-complete-word-dict ispell-alternate-dictionary - "*Dictionary used for word completion." + "*Plain word-list dictionary used for word completion." :type '(choice file (const :tag "None" nil)) :group 'ispell) @@ -2273,6 +2272,12 @@ (if (null lookup-dict) (setq lookup-dict ispell-alternate-dictionary)) + (if lookup-dict + (unless (file-readable-p lookup-dict) + (error "lookup-words error: Unreadable or missing plain word-list %s." + lookup-dict)) + (error "lookup-words error: No plain word-list found at system default locations. Customize `ispell-alternate-dictionary' to set yours.")) + (let* ((process-connection-type ispell-use-ptys-p) (wild-p (string-match "\\*" word)) (look-p (and ispell-look-p ; Only use look for an exact match. --vtzGhvizbBRQ85DL--