[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#69703: Ispell process restarted too often
From: |
Juri Linkov |
Subject: |
bug#69703: Ispell process restarted too often |
Date: |
Thu, 14 Mar 2024 19:50:08 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) |
BTW, currently the order or enabling minor modes and
reading dir-local variables looks wrong: after visiting a file
first minor modes are enabled, then dir-local-variables
are set in the buffer.
So with (add-hook 'text-mode-hook 'flyspell-mode)
Ispell starts the Ispell process with the global dictionary.
Then later reads 'ispell-personal-dictionary' from .dir-locals.el
and restarts the Ispell process with another dictionary.
A workaround for configs is to force 'hack-dir-local-variables'
before enabling 'flyspell-mode' that is not a nice hack:
(defun my-flyspell-mode ()
;; Avoid duplicate calls when ‘flyspell-mode’ is enabled by
‘.dir-locals.el’,
;; because the first call uses the global value of
‘ispell-personal-dictionary’,
;; and so restarts the Ispell process.
(unless (progn (hack-dir-local-variables)
(member '(mode . flyspell) file-local-variables-alist))
(flyspell-mode)))
(add-hook 'text-mode-hook 'my-flyspell-mode)