From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Agustin Martin Newsgroups: gmane.emacs.devel Subject: Re: ispell.el, flyspell.el: better ispell/aspell switching Date: Wed, 16 Apr 2008 11:49:33 +0200 Message-ID: <20080416094933.GA4876@agmartin.aq.upm.es> References: <20080404120217.GA7503@agmartin.aq.upm.es> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1208339456 19416 80.91.229.12 (16 Apr 2008 09:50:56 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 16 Apr 2008 09:50:56 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Apr 16 11:50:58 2008 connect(): Connection refused Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Jm4I1-000082-IZ for ged-emacs-devel@m.gmane.org; Wed, 16 Apr 2008 11:50:53 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Jm4HM-0002dw-Gs for ged-emacs-devel@m.gmane.org; Wed, 16 Apr 2008 05:50:13 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Jm4HF-0002dh-U2 for emacs-devel@gnu.org; Wed, 16 Apr 2008 05:50:05 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Jm4HE-0002dO-JE for emacs-devel@gnu.org; Wed, 16 Apr 2008 05:50:05 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Jm4HE-0002dF-Cy for emacs-devel@gnu.org; Wed, 16 Apr 2008 05:50:04 -0400 Original-Received: from euler.ccupm.upm.es ([138.100.4.67] helo=smtp.upm.es) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Jm4HE-00055N-01 for emacs-devel@gnu.org; Wed, 16 Apr 2008 05:50:04 -0400 Original-Received: from uguindo.aq.upm.es (Agmartin.aq.upm.es [138.100.41.131]) by smtp.upm.es (8.13.8/8.13.8/euler-005) with ESMTP id m3G9nXF6011882; Wed, 16 Apr 2008 11:49:33 +0200 Original-Received: by uguindo.aq.upm.es (Postfix, from userid 1000) id E529366F3; Wed, 16 Apr 2008 11:49:33 +0200 (CEST) Mail-Followup-To: emacs-devel@gnu.org Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17+20080114 (2008-01-14) X-MIME-Autoconverted: from 8bit to quoted-printable by smtp.upm.es id m3G9nXF6011882 X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) 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:95340 Archived-At: On Tue, Apr 15, 2008 at 02:40:23PM -0400, Stefan Monnier wrote: > >>>>> "Agustin" =3D=3D Agustin Martin wr= ites: >=20 > > Hi, >=20 > > I come back with a rewritten approach for a problem in current ispell= .el and > > flyspell.el when switching spellchecker in an emacs session. >=20 > > The problem is as follows, when in an emacs run aspell is used for th= e first > > time, ispell-dictionary-alist is filled with the aspell values, and i= f > > ispell-program-name is customized or changed to ispell during that em= acs run > > it inherits the aspell values, thus failing if there was an aspell en= try > > with the same name. Since ispell is still (rarely) needed for pseudo-= encodings > > like [\'a -> =E1] I think this should not happen and all ispell value= s should > > be restored in such case. Also current behavior is too ispell/aspell > > centric, in case support for another spellchecker is ever added. >=20 > > In the proposed attached patches (ispell-maybe-find-aspell-dictionari= es) is > > replaced by (more neutral) new (ispell-set-spellchecker-params) funct= ion. > > That function will check if spellchecker is changed and fill > > ``ispell-dictionary-alist'' with the appropriate values. As written i= t has > > support for info provided by distros. Patches are mostly as currently= used > > in Debian, with some comments rewritten, and a naive check for [:alph= a:] > > used (instead of just discarding that for xemacs as in Debian). Keepi= ng > > those xemacs checks saves me a couple of patches, please leave them t= here if > > possible. >=20 > This is a good change, but there are a few minor issues with it: >=20 > - ispell-spellchecker-init-pre-hook is not documented. What are > distro-override-dicts-alist and distro-fallback-dicts-alist? The hook is intended for easier interaction of distro maintainers wrt the dictionary alist. E.g., in Debian ispell and aspell dictionary packages provide info about the dictionary that might or not be in original ispell-dictionary-alist. That hook is intended to allow easy modification of both distro-override-dicts-alist and distro-fallback-dicts-alist. These have the same format as ``ispell-dictionary-alist'' and are (very poorly) documented when defined in the 'let', and allow two levels of overriding, ``distro-override-dicts-alist'' will override even dicts in ``found-dicts-alist'' (currently the alist of parsed aspell dicts and associated properties if spellchecker is aspell). Put here just in case i= s ever needed, but I am currently not using it in Debian. ``distro-fallback-dicts-alist'' will just override (or complement if originally not present) initial ``ispell-dictionary-alist'' values (those that are in ``base-dicts'' in the function), so an entry can be fixed wit= hout patching ispell.el or waiting for a new emacs version be released. For instance, this is the relevant part in debian-ispell.el --------------------------- (defun debian-ispell-initialize-dicts-alist () (setq distro-fallback-dicts-alist (if ispell-really-aspell debian-aspell-only-dictionary-alist debian-ispell-only-dictionary-alist))) (add-hook 'ispell-spellchecker-init-pre-hook 'debian-ispell-initialize-di= cts-alist) -------------------------- ``debian-aspell-only-dictionary-alist'' and ``debian-ispell-only-dictiona= ry-alist'' being built after the info provided by the package maintainers. Should I document the hook just in the function, or there is a better pla= ce? > - (setq ispell-last-program-name ispell-program-name) should be done > right after checking if they're equal, not at the end of the function. I usually do this kind of things after the work is done, so is only chang= ed if nothing wrong happened. > - (defvar ispell-aspell-dictionary-alist...) should be before the first > use of that variable. I just put it in the aspell stuff section, but I agree that is better as = you propose, before (ispell-set-spellchecker-params). I should probably move = the ispell-set-spellchecker-params stuff below the aspell stuff, so each has = an own block. > BTW (this is unrelated to this patch, but I just noticed it while > looking at the code): why are ispell-dictionary-alist* autoloaded? > I just tried to remove the autoloads on them and I couldn't notice any > negative effect. As you pointed out, presumably because the way menus were previously buil= t required it.=20 While we are at this, since ``ispell-dictionary-alist'' is in my patch bu= ilt from its components in (ispell-set-spellchecker-params), its original definition may be simplified to just a=20 (defvar ispell-dictionary-alist nil " ..... The long description of ispell-dictionary-list ... follows ...." probably adding a coment like ;; Its actual value will be set in the (ispell-set-spellchecker-params) ;; function --=20 Agustin