emacs-devel
[Top][All Lists]
Advanced

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

Re: Word completion in text modes


From: Eshel Yaron
Subject: Re: Word completion in text modes
Date: Sat, 18 Nov 2023 14:21:30 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Eshel Yaron <me@eshelyaron.com>
>> Date: Sat, 18 Nov 2023 13:03:36 +0100
>> 
>> I wonder how people here feel about updating `text-mode` to have it (and
>> its derivatives) use `completion-at-point` for word completion instead
>> of `ispell-complete-word`.  That'd be accompanied by a new
>> `ispell-completion-at-point` function that `text-mode` adds to
>> `completion-at-point-functions` so word completion still works OOTB,
>> just using a different interface.
>> 
>> I can see several advantages to making such a change:
>> 
>> 1. Word completion would benefit from UI customizations and
>>    other enhancements that users have in place for `completion-at-point`.
>> 2. `completion-preview-mode` and any other feature that leverages
>>    `completion-at-point-functions` would work for word completion as well.
>> 3. Emacs would be slightly more consistent and simple all in all.
>> 
>> The main downside of this idea is that people who prefer the interface
>> that `ispell-complete-word` provides would need to rebind it to `C-M-i`
>> or some other key themselves.  Since this command has been around for a
>> very long time, I can imagine that some users may have grown fond of it.
>
> I don't understand why users of ispell-complete-word would need to
> rebind the command.  ispell-complete-word is by default not bound to
> any key, so if we still provide ispell-complete-word, the old binding,
> if there was one, should still work, and the only difference should be
> the implementation details?  Or what did I miss?

It _is_ bound to `C-M-i` in `text-mode`, that's actually even mentioned
in several places in the Emacs manual, e.g. in "(emacs) Text Mode":

    Text mode binds ‘M-<TAB>’ to ‘ispell-complete-word’.

> In any case, would the text-mode completion-at-point support the
> dictionaries used currently by ispell-complete-word?  If not, why not?

Yes, in my current implementation `ispell-completion-at-point` reuses
the same dictionaries as `ispell-complete-word`.

> Btw, a really great addition to text-mode would be to have completion
> that is based not only on dictionaries that suggest single words, but
> also on dictionaries or other databases that suggest phrases based on
> context.

I agree, that'd be great.

> IMNSHO, such a feature would be much more important and useful than
> the minor changes of UI and reshuffling of the implementation details
> of the sort that you propose.

My proposal would benefit this aim as well, I think, as we could simply
add another completion function to `completion-at-point-functions`, say
`phrase-completion-at-point`, and users would have their word completion
extended to include such phrase completion with no further setup.

> Other applications start offering this kind of features, so I think
> Emacs should have it as well, as we are, after all, a text editor.
> That is not to say that what you suggest is unwelcome or something,
> just that such internal cleanups are maybe not yet the most important
> and useful change in developing and enhancing text-based modes, at
> least IMO.
>
>> So I have a WIP patch that adds `ispell-completion-at-point` (similar to
>> the one proposed in Bug#52743, but slightly enhanced) and updates
>> `text-mode` to use it.  If that sounds sensible and people are not that
>> attached to the `ispell-complete-word` interface for word completion,
>> I'll add some documentation updates and submit that patch for review.
>
> How would being "attached to the `ispell-complete-word` interface for
> word completion" get in the way?

See above.  My concern here regards users that are used to pressing
`C-M-i` in `text-mode` and friends, and getting `ispell-complete-word`.
If we follow my suggestion of removing this binding, `C-M-i` would
invoke `completion-at-point`, providing similar functionality but with a
different interface (by default that would be the *Completions* buffer,
instead of the *Choices* buffer that `ispell-complete-word` provides).
Does that make sense?

> I'd like to understand this better before we decide that this change
> should be installed, and how the modified completion will work.
>
> Thanks.



reply via email to

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