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

From: Eason Huang <[email-masked]>
Date: Wed, 29 Nov 2023 22:03:32 +0800

Eshel Yaron <[email-masked]> writes:

> Eli Zaretskii <[email-masked]> writes:
>
>>> From: Eason Huang <[email-masked]>
>>>
>>> In the below commit, Emacs support ispell-completion-at-point in
>>> text-mode.
>>>
>>> https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=47e313e9805c527e590df4270062a9185ee9db78
>>>
>>> But it would be nice to add an option to disable this feature.
>>>
>>> Because when I enable the autocomplete by corfu or company, it will
>>> always popup the candidate when I input English charectors.
>>> I don't want to diable the autocomplete of corfu or company, because I
>>> need it in org code block.
>>>
>>>
>>> Workaroud:
>>>
>>> Recently, I have to add this code snippet to disable it.
>>>
>>> ```
>>> (with-eval-after-load 'org
>>>   (add-hook 'text-mode-hook
>>>             (lambda ()
>>>               (remove-hook 'completion-at-point-functions 'ispell-completion-at-point t))))
>>> ```
>>
>> Adding Eshel to this discussion.
>
> Thanks for pinging me.
>
> Eason Huang, IIUC, you've globally set up your completion selection UI
> to pop up automatically.  Before this commit, there were no completion
> sources for text modes OOTB, so your global setting was equivalent in
> practice to something that only affects non-text mode buffers, and that
> was fine.  Is that correct?
No. It's correct on the text file (.txt), but not in org-mode
files. Because org-mode also derived from text-mode.

In my test.org file, I have emacs-lisp code block and so on. in the code
block I do need the UI to pop up automatically.

`C-h, v completion-at-point-functions` on org-mode buffer will get:
```
(cape-elisp-block cape-file tags-completion-at-point-function)
```

> If so, my suggestion would be to change your global autocomplete setting
> such that it doesn't apply for text buffers, seeing as you don't seem to
> want such automatic behavior in these buffers, instead of disabling the
> completion source.

> So I'm not sure another user option is due here.  I think your
> workaround is fine, if that works for you, of course.  But you could
> just as well say `(setq-local corfu-auto nil)` in that hook, no?

No. I need (setq-local corfu-auto t) on org-buffer

-- 
Eason Huang