[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/guess-language ec7c0f6 07/10: Make guess-language-backw
From: |
Stefan Monnier |
Subject: |
[elpa] externals/guess-language ec7c0f6 07/10: Make guess-language-backward-paragraph always go to word boundary |
Date: |
Wed, 17 Apr 2019 08:12:40 -0400 (EDT) |
branch: externals/guess-language
commit ec7c0f68585926debd9ef0b37e79ebefb6335fb1
Author: Michal Sojka <address@hidden>
Commit: Michal Sojka <address@hidden>
Make guess-language-backward-paragraph always go to word boundary
This fixes the problem of marking the last word from previous
paragraph as incorrect if the current paragraph is in different
language.
This is caused by the following: When a change of language is
detected, the whole paragraph is flyspelled by calling flyspell-region
on the paragraph. guess-language-backward-paragraph finds the start of
the paragraph to check and in many cases (e.g. in text-mode), the
found point is on the empty line separating two paragraphs.
flyspell-region start spelling from that point by calling
flyspell-word. This function checks the word under the point or if the
point is in between words, the previous word. Since the start of the
paragraph is between words, the last word of the previous paragraph is
checked against dictionary of current paragraph.
This is fixed by ensuring that guess-language-backward-paragraph
always goes to the first non-whitespace character of the paragraph.
This causes flyspell-word to check the first word in the paragraph and
not that last word on the previous paragraph.
---
guess-language.el | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/guess-language.el b/guess-language.el
index ae68069..b42b71e 100644
--- a/guess-language.el
+++ b/guess-language.el
@@ -159,7 +159,9 @@ most appropriate given the buffer mode."
(if (org-in-item-p)
(org-beginning-of-item-list)
(org-backward-paragraph))
- (backward-paragraph)))
+ (backward-paragraph)
+ (when (looking-at-p "[[:space:]]")
+ (forward-whitespace 1))))
(defun guess-language-forward-paragraph ()
"Uses whatever method for moving to the next paragraph is
- [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, 2019/04/17
- [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 <=