help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ispell select Emacs dictionary on Debian


From: Felix Dietrich
Subject: Re: ispell select Emacs dictionary on Debian
Date: Sun, 01 Aug 2021 14:46:43 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)

Emanuel Berg via Users list for the GNU Emacs text editor
<help-gnu-emacs@gnu.org> writes:

> Felix Dietrich wrote:
>
>> For testing purposes, start Emacs with the “-q”
>> (“--no-init-file”) switch. Do the dictionaries show up then
>> in the dialog of ‘ispell-change-dictionary’?
>
> A lot of dictionaries show up with -q! No idea why, and
> interestingly, american-insane and the other installed do not.
>
>> That file, /var/cache/dictionaries-common/emacsen-ispell-dicts.el,
>> has as its last line
>> 
>>   (setq debian-hunspell-dictionary (debian-ispell-get-hunspell-default))
>> 
>> but the function "debian-ispell-get-hunspell-default" is undefined.

>> Do you use a custom built Emacs or the Debian package?
>
> It is installed from source!

This means that the Debian specific initialisation is not run: the Debian
Emacs package installs a custom “startup.el” file that loads
“debian-startup” [1], which loads the Debian specific configuration; this is
why the function ‘debian-ispell-get-hunspell-default’ is not defined.  If
you want to use the Debian dictionary configuration, you may try to load the
necessary code manually:

    (progn
      (load-file "/usr/share/dictionaries-common/site-elisp/debian-ispell.el")
      (load-file "/var/cache/dictionaries-common/emacsen-ispell-dicts.el")
      (setq ispell-program-name "ispell") ; [2]
      )

I donʼt think you can load all the Debian start-up files, if you have
installed Emacs below /usr/local/: I suspect ‘debian-pkg-add-load-path-item’
[3] will not be able to add Debian specific paths to ‘load-path’ at the
correct position.  There may be other issues as well.

Another solution, maybe more appropriate for a custom installation, could be
to add the dictionaries you are interested in, and that are not already in
‘ispell-dictionary-base-alist’, manually to ‘ispell-local-dictionary-alist’.
Copy the necessary information from emacsen-ispell-dicts.el [4] (or extract
it manually or programmatically from the pertinent files in
/var/lib/dictionaries-common/ispell/):

    (setq ispell-local-dictionary-alist
          '(("american-large"
             "[A-Za-z]"
             "[^A-Za-z]"
             "[']"
             nil
             ("-B" "-d" "american-large")
             nil
             utf-8)))

>>> PS. The Swedish dictionary doesn't work either. It saysff
>>>     "ispell-init-process: Illegal format hash table
>>>     /usr/lib/ispell/svenska.hash - expected magic2 0x9602,
>>>     got 0x414c"
>>
>> Does not work for me either. Seems like a bug. Please report it.
>>
> A bug where, in Debian's wswedish?

The broken hash file belongs to the “iswedish” package.  Therefore, I
would file the bug report against “iswedish”.  (Incidentally, both
“wswedish” and “iswedish” are actually built from the same Debian source
package.)


Footnotes:
[1]  
<https://sources.debian.org/src/emacs/1:27.1+1-3.1/debian/patches/0002-Run-debian-startup-and-set-debian-emacs-flavor.patch/>

[2]  This forces ‘ispell-set-spellchecker-params’ to run and sets
     ‘ispell-dictionary-alist’ appropriately.

[3]  In debian-startup.el:

     
<https://sources.debian.org/src/emacsen-common/3.0.4/debian-startup.el/#L33>

[4]  /var/cache/dictionaries-common/emacsen-ispell-dicts.el


-- 
Felix Dietrich



reply via email to

[Prev in Thread] Current Thread [Next in Thread]