[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/guess-language 2fd5023 093/101: In org buffers use org-
From: |
Stefan Monnier |
Subject: |
[elpa] externals/guess-language 2fd5023 093/101: In org buffers use org-backward/forward-paragraph. |
Date: |
Sat, 23 Feb 2019 10:34:49 -0500 (EST) |
branch: externals/guess-language
commit 2fd50238e1b30603754497195b6411c8996cb769
Author: Titus von der Malsburg <address@hidden>
Commit: Titus von der Malsburg <address@hidden>
In org buffers use org-backward/forward-paragraph.
---
guess-language.el | 22 ++++++++++++++++++----
1 file changed, 18 insertions(+), 4 deletions(-)
diff --git a/guess-language.el b/guess-language.el
index c8b79d7..ef2a1a9 100644
--- a/guess-language.el
+++ b/guess-language.el
@@ -149,6 +149,20 @@ Uses ISO 639-1 to identify languages.")
for regexp = (concat "\\(" regexp "\\)")
collect (cons (car lang) regexp))))
+(defun guess-language-backward-paragraph ()
+ "Uses whatever method for moving to the previous paragraph is
+most appropriate given the buffer mode."
+ (if (eq major-mode 'org-mode)
+ (org-backward-paragraph)
+ (backward-paragraph)))
+
+(defun guess-language-forward-paragraph ()
+ "Uses whatever method for moving to the previous paragraph is
+most appropriate given the buffer mode."
+ (if (eq major-mode 'org-mode)
+ (org-forward-paragraph)
+ (forward-paragraph)))
+
(defun guess-language-region (beginning end)
"Guess language in the specified region.
@@ -170,8 +184,8 @@ Region starts at BEGINNING and ends at END."
(defun guess-language-paragraph ()
"Guess the language of the current paragraph."
- (let ((beginning (save-excursion (backward-paragraph) (point)))
- (end (save-excursion (forward-paragraph) (point))))
+ (let ((beginning (save-excursion (guess-language-backward-paragraph)
(point)))
+ (end (save-excursion (guess-language-forward-paragraph)
(point))))
(guess-language-region beginning end)))
(defun guess-language-line ()
@@ -188,8 +202,8 @@ Calls the functions in
switch the dictionary of the spell checker and do other useful
things like changing the keyboard layout or input method."
(interactive)
- (let ((beginning (save-excursion (backward-paragraph) (point)))
- (end (save-excursion (forward-paragraph) (point))))
+ (let ((beginning (save-excursion (guess-language-backward-paragraph)
(point)))
+ (end (save-excursion (guess-language-forward-paragraph)
(point))))
(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)
- [elpa] externals/guess-language b84e19d 064/101: README fix typo, (continued)
- [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
- [elpa] externals/guess-language 8c8a161 094/101: Treat org lists as one paragraph., Stefan Monnier, 2019/02/23
- [elpa] externals/guess-language 2fd5023 093/101: In org buffers use org-backward/forward-paragraph.,
Stefan Monnier <=
- [elpa] externals/guess-language f54ca4f 086/101: Added test data from LIGA., Stefan Monnier, 2019/02/23
- [elpa] externals/guess-language bad0375 062/101: Always spell check with fast strategy., Stefan Monnier, 2019/02/23
- [elpa] externals/guess-language 044f6d1 074/101: README: Updated documentation regarding new hook, Stefan Monnier, 2019/02/23
- [elpa] externals/guess-language d6c2fac 081/101: README re typo, Stefan Monnier, 2019/02/23
- [elpa] externals/guess-language 7e8c9e2 084/101: Function: guess language of current line., Stefan Monnier, 2019/02/23
- [elpa] externals/guess-language 11f74d0 088/101: Moved test_data.org to subdir., Stefan Monnier, 2019/02/23
- [elpa] externals/guess-language 89537dc 090/101: Merge pull request #16 from peterwvj/master, Stefan Monnier, 2019/02/23
- [elpa] externals/guess-language f6a7861 061/101: Merge pull request #6 from joostkremers/master, Stefan Monnier, 2019/02/23
- [elpa] externals/guess-language 0c4e9ab 069/101: Minor fixes in test data., Stefan Monnier, 2019/02/23
- [elpa] externals/guess-language b8ab800 070/101: Use hooks for greater configurability., Stefan Monnier, 2019/02/23