[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/guess-language 9a49c94 08/10: Make the word under point
From: |
Stefan Monnier |
Subject: |
[elpa] externals/guess-language 9a49c94 08/10: Make the word under point correctly highlighted after change of dictionary |
Date: |
Wed, 17 Apr 2019 08:12:40 -0400 (EDT) |
branch: externals/guess-language
commit 9a49c94cfd095a97e9b96c19f3c254a59600d454
Author: Michal Sojka <address@hidden>
Commit: Michal Sojka <address@hidden>
Make the word under point correctly highlighted after change of dictionary
When the dictionary is switched as a result of detecting different
language, the word under point remains highlighted as
incorrect (according to the previously used dictionary) until the word
is flyspelled again, for example by moving the point out of the word
and back. This is annoying.
This commit fixes that by ensuring that flyspelling the current
paragraph with the new dictionary happens after the return from
flyspell-incorrect-hook, which highlights the word under point
according to the old dictionary.
---
guess-language.el | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/guess-language.el b/guess-language.el
index b42b71e..3f79e62 100644
--- a/guess-language.el
+++ b/guess-language.el
@@ -240,11 +240,17 @@ which LANG was detected."
(new-dictionary (cadr (assq lang guess-language-langcodes))))
(unless (string= old-dictionary new-dictionary)
(ispell-change-dictionary new-dictionary)
- (let ((flyspell-issue-welcome-flag nil)
- (flyspell-issue-message-flag nil)
- (flyspell-incorrect-hook nil)
- (flyspell-large-region 1))
- (flyspell-region beginning end)))))
+ ;; Flyspell the region with the new dictionary after we return
+ ;; from flyspell-incorrect-hook that called us. Otherwise, the
+ ;; word at point is highlighted as incorrect even if it is
+ ;; correct according to the new dictionary.
+ (run-at-time 0 nil
+ (lambda ()
+ (let ((flyspell-issue-welcome-flag nil)
+ (flyspell-issue-message-flag nil)
+ (flyspell-incorrect-hook nil)
+ (flyspell-large-region 1))
+ (flyspell-region beginning end)))))))
(defun guess-language-switch-typo-mode-function (lang _beginning _end)
"Switch the language used by typo-mode.
- [elpa] externals/guess-language updated (7b84003 -> 2852aa6), Stefan Monnier, 2019/04/17
- [elpa] externals/guess-language 5ec9b58 02/10: Fix typo., Stefan Monnier, 2019/04/17
- [elpa] externals/guess-language 49b1237 03/10: Add Type for defcustom., Stefan Monnier, 2019/04/17
- [elpa] externals/guess-language 5edde0d 04/10: Added README with information about language data., Stefan Monnier, 2019/04/17
- [elpa] externals/guess-language d2a1330 01/10: A bunch of small improvements suggested by Stefan Monnier., Stefan Monnier, 2019/04/17
- [elpa] externals/guess-language 2852aa6 10/10: Merge remote-tracking branch 'guess-language/master' into externals/guess-language, Stefan Monnier, 2019/04/17
- [elpa] externals/guess-language 3b7acbb 05/10: Remove advice dependency., Stefan Monnier, 2019/04/17
- [elpa] externals/guess-language e64d88f 09/10: Merge pull request #25 from wentasah/fixes, Stefan Monnier, 2019/04/17
- [elpa] externals/guess-language 9a49c94 08/10: Make the word under point correctly highlighted after change of dictionary,
Stefan Monnier <=
- [elpa] externals/guess-language 09e1a41 06/10: Fix #23., Stefan Monnier, 2019/04/17
- [elpa] externals/guess-language ec7c0f6 07/10: Make guess-language-backward-paragraph always go to word boundary, Stefan Monnier, 2019/04/17