[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/guess-language bc6fe11 099/101: Fix bug in `guess-langu
From: |
Stefan Monnier |
Subject: |
[elpa] externals/guess-language bc6fe11 099/101: Fix bug in `guess-language-forward- paragraph`. |
Date: |
Sat, 23 Feb 2019 10:34:51 -0500 (EST) |
branch: externals/guess-language
commit bc6fe11d7ea36d5319ac05c00d52b50d42d64cea
Author: Titus von der Malsburg <address@hidden>
Commit: Titus von der Malsburg <address@hidden>
Fix bug in `guess-language-forward- paragraph`.
And simplified `guess-language-backward-paragraph`. Context is #20.
---
guess-language.el | 29 ++++++++++-------------------
1 file changed, 10 insertions(+), 19 deletions(-)
diff --git a/guess-language.el b/guess-language.el
index 7550b6d..da69933 100644
--- a/guess-language.el
+++ b/guess-language.el
@@ -158,30 +158,19 @@ Uses ISO 639-1 to identify languages.")
most appropriate given the buffer mode."
(if (eq major-mode 'org-mode)
;; When in list, go to the beginning of the top-level list:
- (if (org-in-item-p)
- (progn
- (while (and (save-excursion (= (forward-line -1) 0))
- (org-in-item-p))
- (org-beginning-of-item-list)
- (forward-line -1))
- (unless (org-in-item-p)
- (forward-line 1)))
+ (if (org-in-item-p)
+ (org-beginning-of-item-list)
(org-backward-paragraph))
(backward-paragraph)))
(defun guess-language-forward-paragraph ()
- "Uses whatever method for moving to the previous paragraph is
+ "Uses whatever method for moving to the next paragraph is
most appropriate given the buffer mode."
(if (eq major-mode 'org-mode)
- (if (org-list-struct)
- (let ((last-pos nil)
- (new-pos (car (last (first (last (org-list-struct)))))))
- (while (not (eq last-pos new-pos))
- (setq last-pos new-pos)
- (setq new-pos (car (last (first (last (org-list-struct)))))))
- (goto-char new-pos))
- (org-forward-paragraph))
- (forward-paragraph)))
+ (if (org-in-item-p)
+ (org-end-of-item-list)
+ (org-forward-paragraph))
+ (forward-paragraph)))
(defun guess-language-region (beginning end)
"Guess language in the specified region.
@@ -227,8 +216,10 @@ things like changing the keyboard layout or input method."
(when (> (- end beginning) guess-language-min-paragraph-length)
(let ((lang (guess-language-region beginning end)))
(run-hook-with-args 'guess-language-after-detection-functions lang
beginning end)
- (setq guess-language-current-language lang)))))
+ (setq guess-language-current-language lang)
+ (message (format "Detected language: %s" (caddr (assoc lang
guess-language-langcodes))))))))
+ (setq lang 'en)
(defun guess-language-function (beginning end doublon)
"Wrapper for `guess-language' because `flyspell-incorrect-hook'
provides three arguments that we don't need."
- [elpa] externals/guess-language 93dcc15 071/101: Display ISO 639-1 code in mode line., (continued)
- [elpa] externals/guess-language 93dcc15 071/101: Display ISO 639-1 code in mode line., Stefan Monnier, 2019/02/23
- [elpa] externals/guess-language c2c0206 082/101: Make variable buffer local by default., Stefan Monnier, 2019/02/23
- [elpa] externals/guess-language 8264b3b 067/101: Add missing defgroup., Stefan Monnier, 2019/02/23
- [elpa] externals/guess-language 9763f9e 066/101: Fix #12: boundp wants a symbol, Stefan Monnier, 2019/02/23
- [elpa] externals/guess-language 8813bbf 076/101: README minor, Stefan Monnier, 2019/02/23
- [elpa] externals/guess-language 2bc0e1f 095/101: Fix endless loop in org lists at beginning of buffer., Stefan Monnier, 2019/02/23
- [elpa] externals/guess-language d1a43df 087/101: README: some details about minimal paragraph length, Stefan Monnier, 2019/02/23
- [elpa] externals/guess-language 1516fbe 091/101: README: how to switch voice in festival, Stefan Monnier, 2019/02/23
- [elpa] externals/guess-language 1afd382 097/101: defcustom to set the trigrams path, Stefan Monnier, 2019/02/23
- [elpa] externals/guess-language 03e69d0 100/101: Removed some cruft., Stefan Monnier, 2019/02/23
- [elpa] externals/guess-language bc6fe11 099/101: Fix bug in `guess-language-forward- paragraph`.,
Stefan Monnier <=
- [elpa] externals/guess-language 8450268 058/101: README: Configuration, Stefan Monnier, 2019/02/23
- [elpa] externals/guess-language b84e19d 064/101: README fix typo, Stefan Monnier, 2019/02/23
- [elpa] externals/guess-language d9933d3 075/101: Keep switching typo-mode., Stefan Monnier, 2019/02/23
- [elpa] externals/guess-language c369ef5 063/101: Type-mode is not a dependency anymore., Stefan Monnier, 2019/02/23
- [elpa] externals/guess-language f610859 057/101: Find data files more robustly., Stefan Monnier, 2019/02/23
- [elpa] externals/guess-language 881e261 068/101: Improve docstrings., Stefan Monnier, 2019/02/23
- [elpa] externals/guess-language 4177b92 080/101: Typo-mode is not anymore a dependency., Stefan Monnier, 2019/02/23
- [elpa] externals/guess-language c0a9cd3 079/101: Mention custom functions in commentary., Stefan Monnier, 2019/02/23
- [elpa] externals/guess-language 1f0d9d9 083/101: Fix docstring., Stefan Monnier, 2019/02/23
- [elpa] externals/guess-language 1ab9637 085/101: Added guess-language-mark-lines for debugging., Stefan Monnier, 2019/02/23