From: Eshel Yaron via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 70321@debbugs.gnu.org, Pedro Andres Aranda Gutierrez <paaguti@gmail.com>
Subject: bug#70321: Can not turn completion-at-point on a per-mode basis on modes derived from text-mode
Date: Thu, 11 Apr 2024 07:52:25 +0200 [thread overview]
Message-ID: <m1sezsjvja.fsf@dazzs-mbp.kpn> (raw)
In-Reply-To: <86wmp5uyh1.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 10 Apr 2024 16:41:14 +0300")
Hi Eli, Pedro,
Eli Zaretskii <eliz@gnu.org> writes:
>> From: Pedro Andres Aranda Gutierrez <paaguti@gmail.com>
>> Date: Wed, 10 Apr 2024 09:08:08 +0200
>>
>> Place the following file as init.el in a directory (e.g. ~/.demacs.d)
>>
>> ---cut here---
>> (setq inhibit-startup-screen t)
>>
>> (defun auto-complete-text-off ()
>> (message "Trying to turn off ispell completion...")
>> (setopt text-mode-ispell-word-completion nil))
>>
>> (add-hook 'org-mode-hook #'auto-complete-text-off)
>> (add-hook 'org-mode-hook #'(lambda()
>> (ispell-change-dictionary "en_GB")
>> (flyspell-mode t)))
>> ---cut here---
>>
>> Open a text file and C-h C-v completion-at-point-functions. You should see
>> ispell-completion-at-point in the list of completion functions
>>
>> Open a .org file and C-h C-v completion-at-point-functions. You see
>> ispell-completion-at-point in the list of completion functions, when the expected behaviour
>> is that ispell-completion-at-point is *not* in the list.
>
> You cannot set this option in a mode hook, that's not how it is
> supposed to be used. If you customize the option to nil, any buffer
> under Text mode or its derivative created afterwards will have the
> completion turned off, that's the intended use of the option.
>
> If you want to disable the completion selectively in a mode hook of
> some descendant of Text mode, you need to remove
> ispell-completion-at-point from the appropriate hook explicitly:
>
> (defun auto-complete-text-off ()
> (message "Trying to turn off ispell completion...")
> (remove-hook 'completion-at-point-functions #'ispell-completion-at-point t))
>
> I see no bug here, just a misunderstanding.
>
> Eshel, am I missing something here?
I don't think you're missing anything here. ispell-completion-at-point
is just a function that can either be in completion-at-point-functions
or not. The option text-mode-ispell-word-completion controls whether
text-mode adds ispell-completion-at-point to c-a-p-f initially, but
users can also always rely on add/remove-hook to manage it directly.
Best,
Eshel
next prev parent reply other threads:[~2024-04-11 5:52 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-10 7:08 bug#70321: Can not turn completion-at-point on a per-mode basis on modes derived from text-mode Pedro Andres Aranda Gutierrez
2024-04-10 13:41 ` Eli Zaretskii
2024-04-10 14:47 ` Pedro Andres Aranda Gutierrez
2024-04-11 5:52 ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2024-04-11 7:59 ` Pedro Andres Aranda Gutierrez
2024-04-12 7:36 ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m1sezsjvja.fsf@dazzs-mbp.kpn \
--to=bug-gnu-emacs@gnu.org \
--cc=70321@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=me@eshelyaron.com \
--cc=paaguti@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.