bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#70321: Can not turn completion-at-point on a per-mode basis on modes


From: Eli Zaretskii
Subject: bug#70321: Can not turn completion-at-point on a per-mode basis on modes derived from text-mode
Date: Wed, 10 Apr 2024 16:41:14 +0300

> 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?





reply via email to

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