From: Stefan Monnier <monnier@iro.umontreal.ca>
To: emacs-devel@gnu.org
Subject: Re: ispell.el, flyspell.el: better ispell/aspell switching
Date: Thu, 17 Apr 2008 21:38:51 -0400 [thread overview]
Message-ID: <jwvej94eyo0.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <20080417175637.GA4277@agmartin.aq.upm.es> (Agustin Martin's message of "Thu, 17 Apr 2008 19:56:37 +0200")
>> > ``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 is ever needed, but I am currently not using it in Debian.
>>
>> In what kind of circumstance would this be needed?
> I put this there just for completeness, but I do not think of a particular
> case where this is actually needed. The only thing I can think of is to
> work around a bad aspell autodetection for a dict, but in this case is the
> autodetection what needs a fix. Not a problem to remove it.
>> > ``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 without patching ispell.el or waiting for a new emacs version
>> > be released.
>>
>> Can't this be done by:
>> 1 - remove autoloads on ispell-dictionary-alist-N
>> 2 - merge ispell-dictionary-alist-N into ispell-base-dictionary-alist
>> 3 - let Debian use after-eval-hook to adjust ispell-base-dictionary-alist
> (I guess you mean after-load-hook instead of after-eval-hook) Note that
> this will fail if spellchecker is switched after ispell.el is loaded. If so,
> ispell-base-dictionary-alist will be left with the old values, that might
> not match what the new available dicts (or new needs) for spellchecker.
Oh, because you want to modify a ispel--independent list but you want to
modify it in a ispell-dependent way. Yes, I see it doesn't cut it.
>> > 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)))
>>
>> Why does Debian need to do that? I.e. What kind of changes does
>> this effect? Why doesn't ispell.el get it right on its own?
> Note that we use the same FSF ispell.el and flyspell.el (with a number of
> compatibility patches and some known limitations) for emacs21, emacs22 and
> xemacs, so dictionaries are integrated in a similar way for all emacs
> flavours. Those are in a package different from the {x}emacs* that get
> installed along with the ispell or aspell dictionaries.
> The current way of doing things is that dictionary maintainers provide info
> that is used to build a dictionary-alist for the really installed dicts
> after the provided info. That makes debian-aspell-only-dictionary-alist for
> the aspell dicts and debian-ispell-only-dictionary-alist for the ispell
> dicts, and that is the info passed to the hook as
> distro-fallback-dicts-alist.
> One advantage of this is that there is no need to patch ispell.el each time
> a new dictionary package is added to Debian or some info is fixed, and the
> right dictionary-alists are automagically rebuilt every time a dictionary
> package is installed in the user box. Note that for emacs and aspell this
> would not be a big problem because of the autodetection, but is a problem
> for emacs and ispell as well as for xemacs.
> The other advantage is that we do not try to have ispell.el entries for
> every language having a dict, so original alist is smaller.
>> > (add-hook 'ispell-spellchecker-init-pre-hook
>> > 'debian-ispell-initialize-dicts-alist)
>>
>> > ``debian-aspell-only-dictionary-alist'' and
>> > ``debian-ispell-only-dictionary-alist'' being built after the info
>> > provided by the package maintainers.
>>
>> I must say that I generally prefer if there aren't any hooks and when we
>> don't use dynamic scoping, so I'm not thrilled about this code.
>> I understand that there might be a need for some hook, but I'd rather it
>> doesn't use dynamic scoping. Could you get away with a normal hook run
>> at the end of ispell-set-spellchecker-params, which would work by
>> modifying ispell-dictionary-alist?
> Disclaimer: Although I do some elisp hacking, I am far from being an elisp
> expert, so do not be surprised if I need some reading before understanding
> some details, or even finally do not fully understand them. Thanks in
> advance for your patience.
> I think the important point is at which time is this extra distro info to be
> processed if present (or of course if minimal support for this possible
> extra info belongs to pristine ispell.el or is something expected from
> distros).
I think it's perfectly fine to include it in ispell.el (it doesn't have
to be limited to the use of distro's tho, so I'd rather not use the word
"distro". As a general rule, variables and functions should take names
that describe what they do rather than in what context they'll be used)
> I think this is better done as currently, just in the middle, that
> is, after parsed aspell dicts, but before base-dicts. You do not know where
> things come from if things are done at the end, and if you need to check it
> you may end reusing half of the function.
Is it ever necessary/important to distinguish whether it comes from the
base or fom the parsed dicts?
> If the problem is about using a hook there, something like
No, the problem is the dynamically scoped variables. But if there's no
easy way to do without them, it's OK to use such things. Just use more
descriptive names, and be sure to document them in the hook's docstring.
Stefan
next prev parent reply other threads:[~2008-04-18 1:38 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-04 12:02 ispell.el, flyspell.el: better ispell/aspell switching Agustin Martin
2008-04-15 18:00 ` Agustin Martin
2008-04-15 18:14 ` Lennart Borgman (gmail)
2008-04-15 18:40 ` Stefan Monnier
2008-04-15 18:47 ` Jason Rumney
2008-04-16 1:22 ` Stefan Monnier
2008-04-16 9:49 ` Agustin Martin
2008-04-16 15:21 ` Stefan Monnier
2008-04-17 17:56 ` Agustin Martin
2008-04-18 1:38 ` Stefan Monnier [this message]
2008-04-21 17:15 ` Agustin Martin
2008-04-23 20:40 ` Stefan Monnier
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwvej94eyo0.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).