Hello, On Tue, Nov 19 2024, Eshel Yaron wrote: > Side note: it is better to use (completion-preview-active-mode -1) > instead of (completion-preview-hide) to dismiss the preview, since > disabling the minor mode performs additional cleanup. Perhaps I should > mention that in the documentation somewhere... :) > Thank you for that tip! > Thank you for this report. I can reproduce the extended delay here. > (In the future, please provide a minimal recipe to reproduce the issue > starting from emacs -Q, if possible.) Apologies for a bit noisy report, I wrote it in a bit of a rush. If anyone would like to reproduce this issue, I believe below recipe should be helpful: (require 'flyspell) (add-hook 'org-mode-hook #'flyspell-mode) (require 'completion-preview) (setopt completion-preview-idle-delay 0.2) (push 'org-self-insert-command completion-preview-commands) (global-completion-preview-mode 1) After that open an Org file and try to trigger completion-preview by writing a part of a word. Completion results most likely depend on the contents of file pointed by ispell-alternate-dictionary value. If that file is empty there might be no completions available. > The root cause is a peculiarity of flyspell-mode: it calls sit-for and > blocks Emacs for 3 whole seconds (by default, see flyspell-delay) after > certain commands, including after (org-)self-insert-command. This also > blocks the idle timer that Completion Preview mode uses, unfortunately. > > A quick search shows that this behavior of flyspell affects other > features as well. For example, IIUC, auto completion in Corfu switched > to using run-at-time instead of run-with-idle-timer due to this issue. > > I think flyspell should be modified to use a timer instead of sit-for, > so as to avoid blocking idle timers. I can come up with such a patch, > but it's not quite trivial, so I wonder what others think about this > issue and how it should be addressed. > > As a stopgap, you can try setting flyspell-delay to 0. Thank you for help and explanation. I will try flyspell-delay 0 for a time (or stick with completion-preview-mode only for prog-mode buffers at it seems more appropriate). Kind wishes, Tomasz Hołubowicz