From: Lars Ingebrigtsen <larsi@gnus.org>
To: "Ole Jørgen Brønner" <olejorgenb@gmail.com>
Cc: 24050@debbugs.gnu.org
Subject: bug#24050: 24.5; ispell-change-dictionary suggests non-existent dicts (aspell)
Date: Sun, 28 Jul 2019 12:25:16 +0200 [thread overview]
Message-ID: <87k1c2cv77.fsf@mouse.gnus.org> (raw)
In-Reply-To: <CA+MVPv5Dk=Y=atXVeL3KNWxjxdVa0a2rAQ2zNvWOLXTEc-Uwqw@mail.gmail.com> ("Ole \=\?utf-8\?Q\?J\=C3\=B8rgen_Br\=C3\=B8nner\=22's\?\= message of "Thu, 21 Jul 2016 21:49:06 +0200")
Ole Jørgen Brønner <olejorgenb@gmail.com> writes:
> There's a dedicated function, `ispell-find-aspell-dictionaries`, to find valid
> aspell dictionaries. It sanely ask bin/aspell for the list and then does some
> post-processing to find the rest of the spec.
>
> But after the *correct* list has been found this code[1] is run:
>
> ;; Merge into FOUND any elements from the standard
> ispell-dictionary-base-alist
> ;; which have no element in FOUND at all.
> (dolist (dict ispell-dictionary-base-alist)
> (unless (assoc (car dict) found)
> (setq found (nconc found (list dict)))))
>
> Adding invalid entries to the list. There might be a rationale behind that, but
> to me is seems like `ispell-dictionary-base-alist` mostly exist due to lack of
> *ispell* (old aspell?) introspection? (When using *ispell* as the
> provider, invalid entries
> are filtered out in `ispell-valid-dictionary-list`)
>
> Removing that code isn't enough though:
>
> In `ispell-set-spellchecker-params` the invalid entries are added again:
> (where `found-dicts-alist` is the result of `ispell-find-aspell-dictionaries`
> in when aspell is used)
>
> (run-hooks 'ispell-initialize-spellchecker-hook)
>
> ;; Add dicts to ``ispell-dictionary-alist'' unless already present.
> (dolist (dict (append found-dicts-alist
> ispell-base-dicts-override-alist
> ispell-dictionary-base-alist))
> (unless (assoc (car dict) all-dicts-alist)
> (add-to-list 'all-dicts-alist dict)))
> (setq ispell-dictionary-alist all-dicts-alist))
>
> This code seems to have two purposes:
> - When *ispell* is the provider, `found-dicts-alist` is nil at this
> point, so the
> default entries must be added
> - Apply dictionary overrides (possibly set by the hook above)
(I'm going through old Emacs bug reports that haven't received any
response.)
Thanks for the analysis; altering the code along these lines does fix
the problem, and `M-x ispell-change-dictionary' now seems a lot more
useful now that it just lists the dictionaries I actually have
installed.
> I would suggest simply removing [1] and not add the *base-alist above when using
> aspell/hunspell, but the following comment makes it seem like the "invalid"
> entries are added intentionally:
>
> ;; Substitute ispell-dictionary-alist with the list of
> ;; dictionaries corresponding to the given spellchecker.
> ;; If a recent aspell or hunspell, use the list of really
> ;; installed dictionaries and add to it elements of the original
> ;; list that are not present there*. Allow distro info.
It may be intentional, but the other comments seem to indicate that it's
not... and I don't see the utility of listing dictionaries we don't
have, so I think it's a good change anyway.
So I've made it on the Emacs trunk now.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
next prev parent reply other threads:[~2019-07-28 10:25 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-21 19:49 bug#24050: 24.5; ispell-change-dictionary suggests non-existent dicts (aspell) Ole Jørgen Brønner
2019-07-28 10:25 ` Lars Ingebrigtsen [this message]
2019-07-28 14:17 ` Eli Zaretskii
2019-07-28 14:25 ` Lars Ingebrigtsen
2019-07-28 14:51 ` Eli Zaretskii
2019-07-28 15:08 ` Lars Ingebrigtsen
2019-07-28 16:22 ` Eli Zaretskii
2019-07-29 11:12 ` Lars Ingebrigtsen
2019-07-29 15:06 ` Eli Zaretskii
2019-07-30 11:22 ` Lars Ingebrigtsen
2019-07-30 14:42 ` Eli Zaretskii
2019-07-29 14:32 ` Agustin Martin
2022-02-21 16:01 ` Lars Ingebrigtsen
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=87k1c2cv77.fsf@mouse.gnus.org \
--to=larsi@gnus.org \
--cc=24050@debbugs.gnu.org \
--cc=olejorgenb@gmail.com \
/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).