all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Localize `ispell-completion-at-point'
@ 2023-12-13 19:45 Arash Esbati
  2023-12-14  7:13 ` Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: Arash Esbati @ 2023-12-13 19:45 UTC (permalink / raw)
  To: emacs-devel

Hi all,

is it possible to get localized completions with
`ispell-completion-at-point', preferably depending on
`ispell-dictionary'?  I'm using Emacs from master (6abea4d98d) and I get
only completions in text mode in English which is expected with:

,----[ C-h v ispell-alternate-dictionary RET ]
| ispell-alternate-dictionary is a variable defined in ‘ispell.el’.
| 
| Its value is "/usr/share/dict/web2"
| 
| Alternate plain word-list dictionary for spelling help.
| This is also used by ‘ispell-lookup-words’ and ‘ispell-complete-word’.
`----

Is it up to the user to change the value of `ispell-alternate-directory'
or `ispell-complete-word-dict' depending on the active language or can
this be done inside ispell.el?

Best, Arash



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Localize `ispell-completion-at-point'
  2023-12-13 19:45 Localize `ispell-completion-at-point' Arash Esbati
@ 2023-12-14  7:13 ` Eli Zaretskii
  2023-12-14  9:21   ` Arash Esbati
  0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2023-12-14  7:13 UTC (permalink / raw)
  To: Arash Esbati; +Cc: emacs-devel

> From: Arash Esbati <arash@gnu.org>
> Date: Wed, 13 Dec 2023 20:45:10 +0100
> 
> Hi all,
> 
> is it possible to get localized completions with
> `ispell-completion-at-point', preferably depending on
> `ispell-dictionary'?  I'm using Emacs from master (6abea4d98d) and I get
> only completions in text mode in English which is expected with:
> 
> ,----[ C-h v ispell-alternate-dictionary RET ]
> | ispell-alternate-dictionary is a variable defined in ‘ispell.el’.
> | 
> | Its value is "/usr/share/dict/web2"
> | 
> | Alternate plain word-list dictionary for spelling help.
> | This is also used by ‘ispell-lookup-words’ and ‘ispell-complete-word’.
> `----
> 
> Is it up to the user to change the value of `ispell-alternate-directory'
> or `ispell-complete-word-dict' depending on the active language or can
> this be done inside ispell.el?

Currently, you are supposed to change the dictionary manually, yes.
Are there any free word lists in the format expected by
ispell-completion-at-point in languages other than English?  If so, we
could add a feature that changed that value automatically when the
speller changes the main dictionary, perhaps.  But this would only
work well if those word lists are sufficiently standardized and exist
on many systems.  AFAIK, even the default /usr/share/dict/web2 doesn't
exist on many systems nowadays.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Localize `ispell-completion-at-point'
  2023-12-14  7:13 ` Eli Zaretskii
@ 2023-12-14  9:21   ` Arash Esbati
  2023-12-14  9:32     ` Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: Arash Esbati @ 2023-12-14  9:21 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

> Currently, you are supposed to change the dictionary manually, yes.

Thanks for the confirmation.

> Are there any free word lists in the format expected by
> ispell-completion-at-point in languages other than English?

I searched only for a German word list which seems to be available
here[1].  README.txt says:

  The format is one word per line, alphabetically ordered, ANSI-encoded
  (Latin-1), with Windows line endings (CR-LF).

Changing it to utf8 and unix line endings should be easy.

> If so, we could add a feature that changed that value automatically
> when the speller changes the main dictionary, perhaps.  But this would
> only work well if those word lists are sufficiently standardized and
> exist on many systems.

I didn't test but it seems possible to dump aspell dictionaries into
plain word lists.[2]

> AFAIK, even the default /usr/share/dict/web2 doesn't exist on many
> systems nowadays.

Maybe, on macOS, it is provided OOTB.  One can create an English word
list easily here[3].

Best, Arash

Footnotes:
[1]  https://sourceforge.net/projects/germandict/

[2]  https://superuser.com/a/1636272

[3]  http://app.aspell.net/create




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Localize `ispell-completion-at-point'
  2023-12-14  9:21   ` Arash Esbati
@ 2023-12-14  9:32     ` Eli Zaretskii
  2023-12-14 11:02       ` Arash Esbati
  0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2023-12-14  9:32 UTC (permalink / raw)
  To: Arash Esbati; +Cc: emacs-devel

> From: Arash Esbati <arash@gnu.org>
> Cc: emacs-devel@gnu.org
> Date: Thu, 14 Dec 2023 10:21:48 +0100
> 
> > Are there any free word lists in the format expected by
> > ispell-completion-at-point in languages other than English?
> 
> I searched only for a German word list which seems to be available
> here[1].  README.txt says:
> 
>   The format is one word per line, alphabetically ordered, ANSI-encoded
>   (Latin-1), with Windows line endings (CR-LF).
> 
> Changing it to utf8 and unix line endings should be easy.
> 
> > If so, we could add a feature that changed that value automatically
> > when the speller changes the main dictionary, perhaps.  But this would
> > only work well if those word lists are sufficiently standardized and
> > exist on many systems.
> 
> I didn't test but it seems possible to dump aspell dictionaries into
> plain word lists.[2]
> 
> > AFAIK, even the default /usr/share/dict/web2 doesn't exist on many
> > systems nowadays.
> 
> Maybe, on macOS, it is provided OOTB.  One can create an English word
> list easily here[3].

Everything is possible, of course.  I have this list on my systems.
But teaching Emacs about the names of such files and the place they
can be found on each system only makes sense if distros include them
in standardized places.  From what you say, I conclude that this is
not the case, with the possible exception of /usr/share/dict/web2,
which we already support.  If this is indeed so, I think leaving this
to manual user customization is TRT.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Localize `ispell-completion-at-point'
  2023-12-14  9:32     ` Eli Zaretskii
@ 2023-12-14 11:02       ` Arash Esbati
  2023-12-14 11:24         ` Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: Arash Esbati @ 2023-12-14 11:02 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

> But teaching Emacs about the names of such files and the place they
> can be found on each system only makes sense if distros include them
> in standardized places.  From what you say, I conclude that this is
> not the case, with the possible exception of /usr/share/dict/web2,
> which we already support.  If this is indeed so, I think leaving this
> to manual user customization is TRT.

What do you think about a custom variable like:

  '((ispell-dic-name . path-to-word-list))

where the user must ensure that the word list is available under the
given path?  So basically, Emacs doesn't need to guess and
`ispell-lookup-words' relies on users input inside
`ispell-completion-at-point'?

Best, Arash



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Localize `ispell-completion-at-point'
  2023-12-14 11:02       ` Arash Esbati
@ 2023-12-14 11:24         ` Eli Zaretskii
  2023-12-14 12:42           ` Arash Esbati
  0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2023-12-14 11:24 UTC (permalink / raw)
  To: Arash Esbati; +Cc: emacs-devel

> From: Arash Esbati <arash@gnu.org>
> Cc: emacs-devel@gnu.org
> Date: Thu, 14 Dec 2023 12:02:29 +0100
> 
> What do you think about a custom variable like:
> 
>   '((ispell-dic-name . path-to-word-list))
> 
> where the user must ensure that the word list is available under the
> given path?  So basically, Emacs doesn't need to guess and
> `ispell-lookup-words' relies on users input inside
> `ispell-completion-at-point'?

It would work, but once again: who are we doing this for, if word
lists, let alone those for languages other than English, are not
widely available?

We already have ispell-change-dictionary-hook, which users can use to
set ispell-alternate-dictionary to a suitable value when the
dictionary is changed.  Isn't that enough, given that
ispell-alternate-dictionary is already a defcustom?



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Localize `ispell-completion-at-point'
  2023-12-14 11:24         ` Eli Zaretskii
@ 2023-12-14 12:42           ` Arash Esbati
  0 siblings, 0 replies; 7+ messages in thread
From: Arash Esbati @ 2023-12-14 12:42 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

> It would work, but once again: who are we doing this for, if word
> lists, let alone those for languages other than English, are not
> widely available?

I agree that this is a niche product.

> We already have ispell-change-dictionary-hook, which users can use to
> set ispell-alternate-dictionary to a suitable value when the
> dictionary is changed.  Isn't that enough, given that
> ispell-alternate-dictionary is already a defcustom?

My question was simply to make it easier for people who will use it.  I
can extend my ispell related functions to set
`ispell-alternate-dictionary' accordingly, that's not a big deal.

I suggest we wait and see how the response from others will be
once the feature is in wider use; then we can revisit this?

Best, Arash



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-12-14 12:42 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-13 19:45 Localize `ispell-completion-at-point' Arash Esbati
2023-12-14  7:13 ` Eli Zaretskii
2023-12-14  9:21   ` Arash Esbati
2023-12-14  9:32     ` Eli Zaretskii
2023-12-14 11:02       ` Arash Esbati
2023-12-14 11:24         ` Eli Zaretskii
2023-12-14 12:42           ` Arash Esbati

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.