Subject: Re: bug#67527: 30.0.50; FR: Add an option to disable ispell completion in text-mode

From: Daniel Mendler <[email-masked]>
Date: Sat, 20 Jan 2024 10:46:00 +0100

Eli Zaretskii <[email-masked]> writes:

>> From: Eason Huang <[email-masked]>
>> Cc: [email-masked],  [email-masked]
>> Date: Sat, 13 Jan 2024 17:03:28 +0800
>> 
>> Eli Zaretskii <[email-masked]> writes:
>> 
>> > I guess I'm confused.  In your original report, which started this
>> > discussion, you said:
>> >
>> >   Because when I enable the autocomplete by corfu or company, it will
>> >   always popup the candidate when I input English characters.
>> >   I don't want to diable the autocomplete of corfu or company, because I
>> >   need it in org code block.
>> >
>> > I was asking about that part in your report -- how did the new support
>> > for completion-at-point in text mode and its descendants change the
>> > behavior when you enable autocomplete by corfu or company, and why
>> > were you talking about disabling autocomplete of corfu and company?
>> >
>> 
>> I have `cape-elisp-block` capf backend in org-buffer, and it only
>> works in code block, that's why I need the autocomplete.
>> 
>> I also need the `flyspell-mode` in org-mode, the `flyspell-mode` will add
>> ispell-completion-at-point to capf, but when I input characters in
>> org-buffer, I don't need the ispell-completion-at-point backend.
>> 
>> Anyway, the below workaround works for me:
>> 
>> ```
>> (add-hook 'text-mode-hook
>>           (lambda ()
>>             (remove-hook 'completion-at-point-functions 'ispell-completion-at-point t)))
>> ```
>
> Thanks.
>
> Eshel, given this feedback, I think it would make sense to add a new
> defcustom that would make text-mode avoid adding
> ispell-completion-at-point to completion-at-point-functions.  Would
> you please submit such a change and the documentation changes to go
> with it?  TIA.

Maybe the existing defcustom `text-mode-meta-tab-ispell-complete-word'
could be renamed and reused, taking three values? This way we avoid
introducing multiple defcustoms for tweaking the same feature.

- `command': Bind `ispell-complete-word' to TAB.
- `capf': Add `ispell-completion-at-point' to the
  `completion-at-point-functions'.
- `nil': None of the above.

Daniel